Display appropriate "no data" messages
This commit is contained in:
parent
9c91a56f8d
commit
3c92453b02
|
@ -9,8 +9,8 @@ class GraphsController < ApplicationController
|
||||||
menu_item :issues, :only => [:issue_growth, :old_issues]
|
menu_item :issues, :only => [:issue_growth, :old_issues]
|
||||||
|
|
||||||
before_filter :find_version, :only => [:target_version_graph]
|
before_filter :find_version, :only => [:target_version_graph]
|
||||||
|
before_filter :confirm_issues_exist, :only => [:issue_growth]
|
||||||
before_filter :find_open_issues, :only => [:old_issues, :issue_age_graph]
|
before_filter :find_open_issues, :only => [:old_issues, :issue_age_graph]
|
||||||
before_filter :find_optional_project, :only => [:issue_growth, :issue_growth_graph]
|
|
||||||
|
|
||||||
helper IssuesHelper
|
helper IssuesHelper
|
||||||
|
|
||||||
|
@ -63,12 +63,10 @@ class GraphsController < ApplicationController
|
||||||
|
|
||||||
# Displays total number of issues over time
|
# Displays total number of issues over time
|
||||||
def issue_growth
|
def issue_growth
|
||||||
render_404 if @project && @project.issues.empty?
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Displays created vs update date on open issues over time
|
# Displays created vs update date on open issues over time
|
||||||
def old_issues
|
def old_issues
|
||||||
render_404 if @project && @project.issues.empty?
|
|
||||||
@issues_by_created_on = @issues.sort {|a,b| a.created_on<=>b.created_on}
|
@issues_by_created_on = @issues.sort {|a,b| a.created_on<=>b.created_on}
|
||||||
@issues_by_updated_on = @issues.sort {|a,b| a.updated_on<=>b.updated_on}
|
@issues_by_updated_on = @issues.sort {|a,b| a.updated_on<=>b.updated_on}
|
||||||
end
|
end
|
||||||
|
@ -172,7 +170,7 @@ class GraphsController < ApplicationController
|
||||||
graph.add_data({
|
graph.add_data({
|
||||||
:data => created_on_line.sort.flatten,
|
:data => created_on_line.sort.flatten,
|
||||||
:title => l(:field_created_on)
|
:title => l(:field_created_on)
|
||||||
})
|
}) unless issues_by_created_on.empty?
|
||||||
|
|
||||||
# Generate the closed_on line
|
# Generate the closed_on line
|
||||||
updated_count = 0
|
updated_count = 0
|
||||||
|
@ -182,7 +180,7 @@ class GraphsController < ApplicationController
|
||||||
graph.add_data({
|
graph.add_data({
|
||||||
:data => updated_on_line.sort.flatten,
|
:data => updated_on_line.sort.flatten,
|
||||||
:title => l(:field_updated_on)
|
:title => l(:field_updated_on)
|
||||||
})
|
}) unless issues_by_updated_on.empty?
|
||||||
|
|
||||||
# Compile the graph
|
# Compile the graph
|
||||||
headers["Content-Type"] = "image/svg+xml"
|
headers["Content-Type"] = "image/svg+xml"
|
||||||
|
@ -259,6 +257,19 @@ class GraphsController < ApplicationController
|
||||||
############################################################################
|
############################################################################
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def confirm_issues_exist
|
||||||
|
find_optional_project
|
||||||
|
if !@project.nil?
|
||||||
|
ids = [@project.id]
|
||||||
|
ids += @project.descendants.active.visible.collect(&:id)
|
||||||
|
@issues = Issue.visible.find(:first, :conditions => ["#{Project.table_name}.id IN (?)", ids])
|
||||||
|
else
|
||||||
|
@issues = Issue.visible.find(:first)
|
||||||
|
end
|
||||||
|
rescue ActiveRecord::RecordNotFound
|
||||||
|
render_404
|
||||||
|
end
|
||||||
|
|
||||||
def find_open_issues
|
def find_open_issues
|
||||||
find_optional_project
|
find_optional_project
|
||||||
if !@project.nil?
|
if !@project.nil?
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
<h2><%= l(:label_graphs_issue_growth) %></h2>
|
<h2><%= l(:label_graphs_issue_growth) %></h2>
|
||||||
|
<% unless @issues.nil? %>
|
||||||
<%= tag("embed", :width => "100%", :height => 300, :type => "image/svg+xml", :src => url_for(:controller => 'graphs', :action => 'issue_growth_graph')) if @project.nil? %>
|
<%= tag("embed", :width => "100%", :height => 300, :type => "image/svg+xml", :src => url_for(:controller => 'graphs', :action => 'issue_growth_graph')) if @project.nil? %>
|
||||||
<%= tag("embed", :width => "100%", :height => 300, :type => "image/svg+xml", :src => url_for(:controller => 'graphs', :action => 'issue_growth_graph', :project_id => @project.id)) unless @project.nil? %>
|
<%= tag("embed", :width => "100%", :height => 300, :type => "image/svg+xml", :src => url_for(:controller => 'graphs', :action => 'issue_growth_graph', :project_id => @project.id)) unless @project.nil? %>
|
||||||
|
<% else %>
|
||||||
|
<%= render :partial => 'issues/list_simple', :locals => { :issues => @issues } %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<% content_for :sidebar do %>
|
<% content_for :sidebar do %>
|
||||||
<%= render :partial => 'issues/sidebar' %>
|
<%= render :partial => 'issues/sidebar' %>
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
<h2><%= l(:label_graphs_old_issues) %></h2>
|
<h2><%= l(:label_graphs_old_issues) %></h2>
|
||||||
|
<% unless @issues_by_created_on.empty? %>
|
||||||
<%= tag("embed", :width => "100%", :height => 300, :type => "image/svg+xml", :src => url_for(:controller => 'graphs', :action => 'issue_age_graph')) if @project.nil? %>
|
<%= tag("embed", :width => "100%", :height => 300, :type => "image/svg+xml", :src => url_for(:controller => 'graphs', :action => 'issue_age_graph')) if @project.nil? %>
|
||||||
<%= tag("embed", :width => "100%", :height => 300, :type => "image/svg+xml", :src => url_for(:controller => 'graphs', :action => 'issue_age_graph', :project_id => @project.id)) unless @project.nil? %>
|
<%= tag("embed", :width => "100%", :height => 300, :type => "image/svg+xml", :src => url_for(:controller => 'graphs', :action => 'issue_age_graph', :project_id => @project.id)) unless @project.nil? %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<div class="splitcontentleft">
|
<div class="splitcontentleft">
|
||||||
<h3 class="icon icon-time"><%= l(:label_issues_by, :value => l(:field_created_on)) %></h3>
|
<h3 class="icon icon-time"><%= l(:label_issues_by, :value => l(:field_created_on)) %></h3>
|
||||||
|
|
|
@ -5,3 +5,5 @@ en:
|
||||||
label_graphs_issue_growth: Total issues over time
|
label_graphs_issue_growth: Total issues over time
|
||||||
label_graphs_issue_status_flow: Recent status changes (within 24 hours)
|
label_graphs_issue_status_flow: Recent status changes (within 24 hours)
|
||||||
label_graphs_assigned_to_status_flow: Recent assignment changes (within 24 hours)
|
label_graphs_assigned_to_status_flow: Recent assignment changes (within 24 hours)
|
||||||
|
warning_no_issues: There are no issues to graph.
|
||||||
|
|
|
@ -8,7 +8,7 @@ class IssuesSidebarGraphHook < Redmine::Hook::ViewListener
|
||||||
output << link_to(l(:label_graphs_issue_growth), {:controller => 'graphs', :action => 'issue_growth', :only_path => true})
|
output << link_to(l(:label_graphs_issue_growth), {:controller => 'graphs', :action => 'issue_growth', :only_path => true})
|
||||||
output << "<br/>"
|
output << "<br/>"
|
||||||
return output
|
return output
|
||||||
elsif !context[:project].nil? && !context[:project].issues.empty?
|
elsif !context[:project].nil?
|
||||||
output = "<h3>#{l(:label_graphs)}</h3>"
|
output = "<h3>#{l(:label_graphs)}</h3>"
|
||||||
output << link_to(l(:label_graphs_old_issues), {:controller => 'graphs', :action => 'old_issues', :project_id => context[:project], :only_path => true})
|
output << link_to(l(:label_graphs_old_issues), {:controller => 'graphs', :action => 'old_issues', :project_id => context[:project], :only_path => true})
|
||||||
output << "<br/>"
|
output << "<br/>"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user