Commit 6ee0ccd21d85683d0d8c413003e13b15e0f64b59
Committed by
Paulo Meireles
1 parent
fb93c857
Exists in
master
and in
23 other branches
Showing information about last project result
Showing
2 changed files
with
107 additions
and
4 deletions
Show diff stats
plugins/mezuro/lib/kalibro/entities/project_result.rb
| @@ -19,7 +19,7 @@ class Kalibro::Entities::ProjectResult < Kalibro::Entities::Entity | @@ -19,7 +19,7 @@ class Kalibro::Entities::ProjectResult < Kalibro::Entities::Entity | ||
| 19 | end | 19 | end |
| 20 | 20 | ||
| 21 | def format_milliseconds(value) | 21 | def format_milliseconds(value) |
| 22 | - seconds = value/1000 | 22 | + seconds = value.to_i/1000 |
| 23 | hours = seconds/3600 | 23 | hours = seconds/3600 |
| 24 | seconds -= hours * 3600 | 24 | seconds -= hours * 3600 |
| 25 | minutes = seconds/60 | 25 | minutes = seconds/60 |
plugins/mezuro/views/content_viewer/show_project.rhtml
| 1 | <% @project = Kalibro::Client::ProjectClient.new.project(@page.name) %> | 1 | <% @project = Kalibro::Client::ProjectClient.new.project(@page.name) %> |
| 2 | 2 | ||
| 3 | -<table id="show_info"> | 3 | +<table id="project_info"> |
| 4 | <tr> | 4 | <tr> |
| 5 | <td><%= _("Name") %></td> | 5 | <td><%= _("Name") %></td> |
| 6 | <td><%= @project.name %></td> | 6 | <td><%= @project.name %></td> |
| @@ -30,14 +30,117 @@ | @@ -30,14 +30,117 @@ | ||
| 30 | <br /> | 30 | <br /> |
| 31 | 31 | ||
| 32 | <% if ! @project.error.nil? %> | 32 | <% if ! @project.error.nil? %> |
| 33 | - <h3>ERROR</h3> | 33 | + <h3><%= _('ERROR') %></h3> |
| 34 | <% @error = @project.error %> | 34 | <% @error = @project.error %> |
| 35 | <p> | 35 | <p> |
| 36 | - <%= "State when error ocurred: #{@project.state}" %> | 36 | + <%= "State when error ocurred: #{@project.state}" %> |
| 37 | <br/> | 37 | <br/> |
| 38 | <%= @error.message %> | 38 | <%= @error.message %> |
| 39 | <ul><% @error.stack_trace.each do |trace| %> | 39 | <ul><% @error.stack_trace.each do |trace| %> |
| 40 | <li><%= "#{trace.declaring_class}.#{trace.method_name}(#{trace.file_name}:#{trace.line_number})" %></li> | 40 | <li><%= "#{trace.declaring_class}.#{trace.method_name}(#{trace.file_name}:#{trace.line_number})" %></li> |
| 41 | <% end %></ul> | 41 | <% end %></ul> |
| 42 | </p> | 42 | </p> |
| 43 | +<% elsif @project.state.end_with? 'ING' %> | ||
| 44 | + <p> | ||
| 45 | + <%= _("Kalibro Service is #{@project.state.downcase} the source code.") %> | ||
| 46 | + <br/> | ||
| 47 | + <%= _("Reload the page manually in a few moments.") %> | ||
| 48 | + </p> | ||
| 49 | +<% elsif @project.state == 'READY' %> | ||
| 50 | + <h3><%= _('LAST RESULT') %></h3> | ||
| 51 | + <% @project_result = Kalibro::Client::ProjectResultClient.new.last_result(@project.name) %> | ||
| 52 | + <table id="project_result_info"> | ||
| 53 | + <tr> | ||
| 54 | + <td><%= _("Date") %></td> | ||
| 55 | + <td><%= @project_result.date %></td> | ||
| 56 | + </tr> | ||
| 57 | + <tr> | ||
| 58 | + <td><%= _("Load time") %></td> | ||
| 59 | + <td><%= @project_result.formatted_load_time %></td> | ||
| 60 | + </tr> | ||
| 61 | + <tr> | ||
| 62 | + <td><%= _("Analysis time") %></td> | ||
| 63 | + <td><%= @project_result.formatted_analysis_time %></td> | ||
| 64 | + </tr> | ||
| 65 | + </table> | ||
| 43 | <% end %> | 66 | <% end %> |
| 67 | + | ||
| 68 | + | ||
| 69 | +<%# if @project.state == 'READY' %> | ||
| 70 | + | ||
| 71 | + <%# if @project.configuration.nil? %> | ||
| 72 | + <%# metric_results = @client.last_module_result(@project.name).metric_results %> | ||
| 73 | + | ||
| 74 | + <%#*<h3>%> | ||
| 75 | + <%#= _("Total Metrics") %> | ||
| 76 | + <%#*</h3>%> | ||
| 77 | + <%#*<table id="total_metrics">%> | ||
| 78 | + <%# total_results = metric_results.each.select {|result| result.native_metric.scope == 'APPLICATION'} %> | ||
| 79 | + <%# total_results.each_with_index do |result, index| %> | ||
| 80 | + <%#*<tr id="tr_<%= result.native_metric.code >" class="d<%= index % 2 >">%> | ||
| 81 | + <%#*<td>%> | ||
| 82 | + <%#= result.native_metric.name %> | ||
| 83 | + <%#*</td>%> | ||
| 84 | + <%#*<td class="metric_box">%> | ||
| 85 | + <%#= result.value %> | ||
| 86 | + <%#*</td>%> | ||
| 87 | + <%#*</tr>%> | ||
| 88 | + <%# end %> | ||
| 89 | + <%#*</table>%> | ||
| 90 | + | ||
| 91 | + <%#*<h3>%> | ||
| 92 | + <%#= _("Statistical Metrics") %> | ||
| 93 | + <%#*</h3>%> | ||
| 94 | + <%# statistical_results = metric_results.each.select {|result| result.native_metric.scope == 'CLASS'} %> | ||
| 95 | + <%# statistical_results.each do |result| %> | ||
| 96 | + <%#*<div id="statistical_metrics">%> | ||
| 97 | + | ||
| 98 | + <%#*<table id="<%= @project.name >_<%= result.native_metric.code >_list">%> | ||
| 99 | + <%#*<thead>%> | ||
| 100 | + <%#*<th>%> | ||
| 101 | + <%#*<img id="<%= @project.name >_<%= result.native_metric.code >_plus"%> | ||
| 102 | + <%#*onclick="collapse('<%= @project.name >_<%= result.native_metric.code >')"%> | ||
| 103 | + <%#*alt="+" src="/plugins/mezuro/images/plus.png" class="collapsable"/>%> | ||
| 104 | + <%#*<img id="<%= @project.name >_<%= result.native_metric.code >_minus" style="display: none"%> | ||
| 105 | + <%#*onclick="collapse('<%= @project.name >_<%= result.native_metric.code >')"%> | ||
| 106 | + <%#*alt="-" src="/plugins/mezuro/images/minus.png" class="collapsable"/>%> | ||
| 107 | + <%#= "#{result.native_metric.name}" %> | ||
| 108 | + <%#*</th>%> | ||
| 109 | + <%#*<th class="metric_box">%> | ||
| 110 | + <%#= "#{result.average}"%> | ||
| 111 | + <%#*</th>%> | ||
| 112 | + <%#*</thead>%> | ||
| 113 | + <%# result.available_statistics.each_with_index do |statistic, index| %> | ||
| 114 | + <%#*<tr class="d<%= index % 2 > statistic" style="display: none">%> | ||
| 115 | + <%#*<td>%> | ||
| 116 | + <%#= statistic %> | ||
| 117 | + <%#*</td>%> | ||
| 118 | + <%#*<td class="metric_box">%> | ||
| 119 | + <%#= result.statistic(statistic) %> | ||
| 120 | + <%#*</td>%> | ||
| 121 | + <%#*</tr>%> | ||
| 122 | + <%# end %> | ||
| 123 | + <%#*</table>%> | ||
| 124 | + <%#*</div>%> | ||
| 125 | + <%# end %> | ||
| 126 | + | ||
| 127 | + <%# else %> | ||
| 128 | + <%# metric_results = @client.last_module_result(@project.name).compiled_metric_results %> | ||
| 129 | + | ||
| 130 | + <%#*<h3>%> | ||
| 131 | + <%#= _("Metrics") %> | ||
| 132 | + <%#*</h3>%> | ||
| 133 | + <%#*<table id="metrics">%> | ||
| 134 | + <%# metric_results.each do |result| %> | ||
| 135 | + <%#*<tr id="tr_<%= result.native_metric.code >">%> | ||
| 136 | + <%#*<td>%> | ||
| 137 | + <%#= result.native_metric.name %> | ||
| 138 | + <%#*</td>%> | ||
| 139 | + <%#*<td class="metric_box">%> | ||
| 140 | + <%#= result.value %> | ||
| 141 | + <%#*</td>%> | ||
| 142 | + <%#*</tr>%> | ||
| 143 | + <%# end %> | ||
| 144 | + <%#*</table>%> | ||
| 145 | + <%# end %> | ||
| 146 | +<%# end %> |