diff options
author | Julien Lancelot <julien.lancelot@gmail.com> | 2013-05-06 13:19:53 +0200 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@gmail.com> | 2013-05-06 13:19:53 +0200 |
commit | eb246cb8c9500942191948910176e830d31edc6b (patch) | |
tree | eca7fbd31095ab134eea8953c0fd9047f00be2d3 | |
parent | 1b80635d4efc258011741a30fdc8602a8d1caa86 (diff) | |
download | sonarqube-eb246cb8c9500942191948910176e830d31edc6b.tar.gz sonarqube-eb246cb8c9500942191948910176e830d31edc6b.zip |
SONAR-3755 Add closed Action Plan list
7 files changed, 65 insertions, 18 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/issues_action_plans_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/issues_action_plans_controller.rb index 72c75954561..1929d4ff32d 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/issues_action_plans_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/issues_action_plans_controller.rb @@ -97,8 +97,8 @@ class IssuesActionPlansController < ApplicationController def load_action_plans # TODO sort open by deadline ASC and closed by deadline DESC action_plans = Internal.issues.actionPlanStats(@resource.key) - @open_action_plans = action_plans.select {|action_plan| action_plan.status == 'OPEN'} - @closed_action_plans = action_plans.select {|action_plan| action_plan.status == 'CLOSED'} + @open_action_plans = action_plans.select {|action_plan| action_plan.isOpen()} + @closed_action_plans = action_plans.select {|action_plan| !action_plan.isOpen()} end end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb b/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb index 450f07d2257..ee37275ad4a 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb @@ -828,9 +828,4 @@ module ApplicationHelper html end - # TODO move to Api - def to_date(java_date) - java_date ? Time.at(java_date.time/1000) : nil - end - end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/api.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/api.rb index 80b4ca6155f..101ef78aa3d 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/api.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/api.rb @@ -27,8 +27,4 @@ class Api Internal.issues_api end - def self.to_date(java_date) - java_date ? Time.at(java_date.time/1000) : nil - end - end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/api/utils.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/api/utils.rb index 14eae5135c0..87502e4401e 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/api/utils.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/api/utils.rb @@ -33,6 +33,11 @@ class Api::Utils Time.parse(datetime_string) end + # Convert java Date to ruby date + def self.to_date(java_date) + java_date ? Time.at(java_date.time/1000) : nil + end + def self.is_number?(s) true if Float(s) rescue false end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/issue/_issue.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/issue/_issue.html.erb index 5e413fcf909..6a0c2fb39c1 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/issue/_issue.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/issue/_issue.html.erb @@ -73,13 +73,13 @@ <%= message('created') -%>: </td> <td class="val"> - <%= l(Api.to_date(@issue.creationDate())) -%> + <%= l(Api::Utils.to_date(@issue.creationDate())) -%> </td> <td class="key"> <%= message('updated') -%>: </td> <td class="val"> - <%= l(Api.to_date(@issue.updateDate())) if @issue.updateDate() -%> + <%= l(Api::Utils.to_date(@issue.updateDate())) if @issue.updateDate() -%> </td> </tr> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/issues_action_plans/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/issues_action_plans/index.html.erb index 2bf43861ea6..61d1e0622b7 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/issues_action_plans/index.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/issues_action_plans/index.html.erb @@ -22,14 +22,12 @@ <% end %> <% @open_action_plans.each do |plan| + deadline = Api::Utils.to_date(plan.deadLine()) if plan.deadLine() %> <tr> <td class="thin nowrap center"><img src="<%= ApplicationController.root_context -%>/images/status/<%= plan.status() -%>.png" title="<%= message('issues_action_plans.status' + plan.status()) -%>"/></td> <td class="thin nowrap"><%= h(plan.name()) -%></td> - - <% deadline = Api.to_date(plan.deadLine()) if plan.deadLine() %> - - <td class="thin nowrap <%= 'over-due' if plan.over_due? -%>" align="right" x="<%= deadline ? deadline.tv_sec : '' -%>"><%= deadline ? deadline.strftime("%d %b %Y") : ' ' -%></td> + <td class="thin nowrap <%= 'over-due' if plan.overDue() -%>" align="right" x="<%= deadline ? deadline.tv_sec : '' -%>"><%= deadline ? deadline.strftime("%d %b %Y") : ' ' -%></td> <% if plan.totalIssues()==0 %> <td class="noprogress thin nowrap"> <%= message('issues_action_plans.no_issues_linked_to_action_plan') -%> @@ -62,6 +60,59 @@ </table> <script>TableKit.Sortable.init('openActionPlans');</script> + <% unless @closed_action_plans.empty? %> + <br/><br/> + <h1><%= message('issues_action_plans.closed_action_plan') -%></h1> + + <table class="width100 data sortable actionPlans" id="closedActionPlans"> + <thead> + <tr> + <th class="thin nowrap"><%= message('issues_action_plans.col.status') -%></th> + <th class="thin nowrap"><%= message('issues_action_plans.col.name') -%></th> + <th class="thin nowrap righticon sortfirstdesc" style="text-align: right"><%= message('issues_action_plans.col.due_for') -%></th> + <th class="thin nowrap righticon" style="text-align: right"><%= message('issues_action_plans.col.closed_on') -%></th> + <th class="nowrap nosort center"><%= message('issues_action_plans.col.progress') -%></th> + <th class="nowrap"><%= message('issues_action_plans.col.description') -%></th> + <th class="nowrap"><%= message('issues_action_plans.col.author') -%></th> + <th class="thin nowrap nosort"><%= message('issues_action_plans.col.operations') -%></th> + </tr> + </thead> + <tbody> + <% + @closed_action_plans.each do |plan| + deadline = Api::Utils.to_date(plan.deadLine()) if plan.deadLine() + updated_at = Api::Utils.to_date(plan.updateDate()) + %> + <tr> + <td class="thin nowrap center"><img src="<%= ApplicationController.root_context -%>/images/status/<%= plan.status() -%>.png" title="<%= message(plan.status()) -%>"/></td> + <td class="thin nowrap"><%= h(plan.name) -%></td> + <td class="thin nowrap <%= 'over-due' if plan.overDue() -%>" align="right" x="<%= deadline ? deadline.tv_sec : '' -%>"><%= deadline ? deadline.strftime("%d %b %Y") : ' ' -%></td> + <td class="thin nowrap" align="right" x="<%= updated_at.tv_sec -%>"><%= updated_at.strftime("%d %b %Y") -%></td> + <% if plan.totalIssues()==0 %> + <td class="noprogress thin nowrap"> + <%= message('issues_action_plans.no_issues_linked_to_action_plan') -%> + </td> + <% else %> + <td class="progress thin"> + <%= render :partial => 'progress', :locals => {:action_plan => plan} -%> + </td> + <% end %> + <td id="desc"><%= h(plan.description()) -%></td> + <% #TODO replace user login by user name -%> + <td id="desc"><%= h(plan.userLogin()) -%></td> + <td class="thin nowrap right"> + <%= link_to message('issues_action_plans.reopen'), + {:action => 'change_status', :id => @resource.id, :plan_key => plan.key}, {:method => 'POST', :class => 'action'} -%> + + <%= link_to message('delete'), {:action => 'delete', :id => @resource.id, :plan_key => plan.key}, {:method => 'POST', :confirm => message('issues_action_plans.confirm_delete'), :class => 'action'} -%> + </td> + </tr> + <% end %> + </tbody> + </table> + <script>TableKit.Sortable.init('closedActionPlans');</script> + <% end %> + </td> <td class="sep"></td> <td width="210" valign="top" align="right"> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_issue.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_issue.html.erb index ff817a8bfd9..d17782ac261 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_issue.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_issue.html.erb @@ -17,7 +17,7 @@ <%= image_tag 'sep12.png' -%> - <span><%= distance_of_time_in_words_to_now(to_date(issue.creationDate())) -%></span> + <span><%= distance_of_time_in_words_to_now(Api::Utils.to_date(issue.creationDate())) -%></span> <% if issue.resolution == 'FALSE-POSITIVE' |