Project

General

Profile

Feature #2122

Cannot Search reports on environment name

Added by Mikael Fridh almost 8 years ago. Updated almost 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Search
Target version:
-
Difficulty:
medium
Triaged:
No
Bugzilla link:
Pull request:
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".

Associated revisions

Revision c85e5e3b (diff)
Added by Mikael Fridh almost 8 years ago

fixes #2122 - Cannot search reports on environment name

Can now filter the reports based on environment.

History

#1 Updated by Ohad Levy almost 8 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

#2 Updated by Mikael Fridh almost 8 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

#3 Updated by Mikael Fridh almost 8 years ago

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

Also available in: Atom PDF