Skip to content

Commit

Permalink
Merge branch 'feature/show-all-app-enviroments-53807' into develop
Browse files Browse the repository at this point in the history
* feature/show-all-app-enviroments-53807:
  show app environments in problems filter
  • Loading branch information
darkleaf committed Sep 5, 2014
2 parents 1e4bdac + a5d0d90 commit 2e8be4c
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 3 deletions.
4 changes: 4 additions & 0 deletions app/helpers/select_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@ def users_for_select
def states(klass)
klass.state_machine.states.map{|s| [s.human_name, s.name]}
end

def default_environments
%w[production staging development]
end
end
4 changes: 4 additions & 0 deletions app/repositories/problem_repository.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,9 @@ def in_env(env)
def in_date_range(date_range)
where(["first_notice_at <= ? AND (resolved_at IS NULL OR resolved_at >= ?)", date_range.end, date_range.begin])
end

def environments
group(:environment).pluck(:environment)
end
end
end
2 changes: 1 addition & 1 deletion app/views/apps/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@

- if @app.problems.any?
%h3.clear=t('.errors')
= render 'problems/search_form', q: @q, url: app_path(@app)
= render 'problems/search_form', q: @q, url: app_path(@app), environments: @app.problems.environments
%section
.problem_table{:id => 'problem_table'}
= render 'problems/table', problems: @problems, q: @q
Expand Down
2 changes: 1 addition & 1 deletion app/views/problems/_search_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
= f.select :state_eq, states(Problem), include_blank: true, selected: q.state_eq
%div
= f.label :environment
= f.select :environment_eq, %w[production staging development test], include_blank: true, selected: q.environment_eq
= f.select :environment_eq, environments, include_blank: true, selected: q.environment_eq
= f.submit
%br
2 changes: 1 addition & 1 deletion app/views/problems/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
- content_for :head do
= auto_discovery_link_tag :atom, problems_path(User.token_authentication_key => current_user.authentication_token, :format => "atom"), :title => "Errbit notices at #{request.host}"

= render 'problems/search_form', q: @q, url: problems_path
= render 'problems/search_form', q: @q, url: problems_path, environments: default_environments
%section
#problem_table.problem_table
= render 'problems/table', problems: @problems, q: @q

0 comments on commit 2e8be4c

Please sign in to comment.