Class: ChefServerSlice::SearchEntries

Inherits:
Application
  • Object
show all
Defined in:
app/controllers/search_entries.rb

Instance Method Summary collapse

Methods inherited from Application

#absolute_slice_url, #access_denied, #authorized_node, #escape_node_id, #expand_cookbook_deps, #fix_up_node_id, #get_available_recipes, #load_all_files, #load_cookbook_segment, #login_required, #redirect_back_or_default, #segment_files, #specific_cookbooks, #store_location

Instance Method Details

#createObject



40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'app/controllers/search_entries.rb', line 40

def create
  @to_index = params
  @to_index.delete(:controller)
  @to_index["index_name"] = params[:search_id]
  @to_index["id"] = "#{params[:search_id]}_#{params[:id]}"
  @to_index.delete(:search_id)
  Chef::Queue.send_msg(:queue, :index, @to_index)
  if content_type == :html
    redirect url(:search)
  else
    @status = 202
    display @to_index
  end
end

#destroyObject



59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'app/controllers/search_entries.rb', line 59

def destroy
  @s = Chef::Search.new
  @entries = @s.search(params[:id])
  @entries.each do |entry|
    Chef::Queue.send_msg(:queue, :remove, entry)
  end
  @status = 202
  if content_type == :html
    redirect url(:search)
  else
    display @entries
  end
end

#indexObject



28
29
30
31
32
# File 'app/controllers/search_entries.rb', line 28

def index
  @s = Chef::Search.new
  @entries = @s.search(params[:search_id])
  display @entries
end

#showObject



34
35
36
37
38
# File 'app/controllers/search_entries.rb', line 34

def show
  @s = Chef::Search.new
  @entry = @s.search(params[:search_id], "id:'#{params[:search_id]}_#{params[:id]}'").first
  display @entry
end

#updateObject



55
56
57
# File 'app/controllers/search_entries.rb', line 55

def update
  create
end