Commit 8e25bba2 authored by Sean Arnold's avatar Sean Arnold

Add AlertManagement Alert state pill

- Update helper, css
- Add alias method
parent 3e2e2a8b
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
} }
&.status-box-issue-closed, &.status-box-issue-closed,
&.status-box-alert-resolved,
&.status-box-mr-merged { &.status-box-mr-merged {
background-color: $blue-500; background-color: $blue-500;
} }
......
...@@ -97,6 +97,8 @@ module TodosHelper ...@@ -97,6 +97,8 @@ module TodosHelper
'mr' 'mr'
when Issue when Issue
'issue' 'issue'
when AlertManagement::Alert
'alert'
end end
content_tag(:span, nil, class: 'target-status') do content_tag(:span, nil, class: 'target-status') do
...@@ -214,7 +216,14 @@ module TodosHelper ...@@ -214,7 +216,14 @@ module TodosHelper
end end
def show_todo_state?(todo) def show_todo_state?(todo)
(todo.target.is_a?(MergeRequest) || todo.target.is_a?(Issue)) && %w(closed merged).include?(todo.target.state) case todo.target
when MergeRequest, Issue
%w(closed merged).include?(todo.target.state)
when AlertManagement::Alert
%w(resolved).include?(todo.target.state)
else
false
end
end end
def todo_group_options def todo_group_options
......
...@@ -127,6 +127,8 @@ module AlertManagement ...@@ -127,6 +127,8 @@ module AlertManagement
scope :counts_by_status, -> { group(:status).count } scope :counts_by_status, -> { group(:status).count }
scope :counts_by_project_id, -> { group(:project_id).count } scope :counts_by_project_id, -> { group(:project_id).count }
alias_method :state, :human_status_name
def self.sort_by_attribute(method) def self.sort_by_attribute(method)
case method.to_s case method.to_s
when 'started_at_asc' then order_start_time(:asc) when 'started_at_asc' then order_start_time(:asc)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment