Project

General

Profile

Actions

Feature #2122

closed

Cannot Search reports on environment name

Added by Mikael Fridh over 11 years ago. Updated over 11 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Search
Target version:
-
Difficulty:
medium
Triaged:
Fixed in Releases:
Found in Releases:

Description

Being able to search / filter the reports per environment would be very useful.

Tried adding simple scoped_search :in => host, :on => :environment but didn't work. Need an :ext_method for it to work?

Ie, want to be able to search on "host.environment = envname" or short: "environment = envname".

Actions #1

Updated by Ohad Levy over 11 years ago

how about


diff --git a/app/models/report.rb b/app/models/report.rb
index f7b0c59..149467f 100644
--- a/app/models/report.rb
+++ b/app/models/report.rb
@@ -5,10 +5,12 @@ class Report < ActiveRecord::Base
   has_many :messages, :through => :logs
   has_many :sources, :through => :logs
   has_many :logs, :dependent => :destroy
+  has_one :environment, :through => :host
   validates_presence_of :host_id, :reported_at, :status
   validates_uniqueness_of :reported_at, :scope => :host_id

   scoped_search :in => :host,     :on => :name, :complete_value => true, :rename => :host
+  scoped_search :in => :environment, :on => :name, :complete_value => true, :rename => :environment
   scoped_search :in => :messages, :on => :value,                         :rename => :log
   scoped_search :in => :sources,  :on => :value,                         :rename => :resource

Actions #2

Updated by Mikael Fridh over 11 years ago

Ohad Levy wrote:

how about
[...]

ok, that makes total sense now when I see it.

submitted https://github.com/theforeman/foreman/pull/361

Actions #3

Updated by Mikael Fridh over 11 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100
Actions

Also available in: Atom PDF