]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-2614 Add time spent on deletion
authorFabrice Bellingard <bellingard@gmail.com>
Fri, 6 Jul 2012 10:38:04 +0000 (12:38 +0200)
committerFabrice Bellingard <bellingard@gmail.com>
Fri, 6 Jul 2012 10:39:02 +0000 (12:39 +0200)
plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties
sonar-server/src/main/webapp/WEB-INF/app/models/resource_deletion_manager.rb
sonar-server/src/main/webapp/WEB-INF/app/views/bulk_deletion/_pending_deletions_screen.html.erb

index 2633daf30ee825c567bffa648e8ab88b3d7c8238..d1fb5fb7af7189ed1fe632f905926fbba8f69320 100644 (file)
@@ -1280,6 +1280,7 @@ bulk_deletion.deletion_manager.no_resource_to_delete=No resource to delete.
 bulk_deletion.deletion_manager.currently_deleting_x_out_of_x=Currently deleting resources... ({0} out of {1})
 bulk_deletion.deletion_manager.deletion_completed=Resource deletion completed.
 bulk_deletion.deletion_manager.however_failures_occurred=However, some failures occurred.
+bulk_deletion.started_since_x=Started {0}
 
 
 #------------------------------------------------------------------------------
index dbdcd73a34899675b9fa18fa5cac401c03ca6232..6ae5e1290346594a0bc566c888467daeeccac73d 100644 (file)
@@ -42,6 +42,9 @@ class ResourceDeletionManager
   # list of resources that could not be deleted because of a problem
   @failed_deletions
   
+  # the time when the deletion was started
+  @start_time
+  
   def initialize
     reinit()
   end
@@ -68,6 +71,10 @@ class ResourceDeletionManager
     @failed_deletions
   end
   
+  def deletion_start_time
+    @start_time
+  end
+  
   def delete_resources(resource_ids=[])
     # Use an exclusive block of code to ensure that only 1 thread will be able to proceed with the deletion
     can_start_deletion = false
@@ -86,6 +93,7 @@ class ResourceDeletionManager
         @message = Api::Utils.message('bulk_deletion.deletion_manager.no_resource_to_delete')
       else
         java_facade = Java::OrgSonarServerUi::JRubyFacade.getInstance()
+        @start_time = Time.now
         # launch the deletion
         resource_ids.each_with_index do |resource_id, index|
           resource = Project.find(:first, :conditions => {:id => resource_id.to_i})
index 27895ebe7dc47dd47036723c1b2e90cb054ca4ed..ab311285ab1a056cdbeb371919e8b1d9d3e9c824 100644 (file)
@@ -2,6 +2,7 @@
   deletion_manager = ResourceDeletionManager.instance
   pending_deletions = deletion_manager.currently_deleting_resources?
   failed_deletions = deletion_manager.failed_deletions
+  start_time = deletion_manager.deletion_start_time
 %>
 
 <% if pending_deletions %>
@@ -18,6 +19,9 @@
   <b><%= deletion_manager.message -%></b>
   <br/>
   <br/>
+  <%= message('bulk_deletion.started_since_x', :params => distance_of_time_in_words(start_time, Time.now) ) -%> (<%= l start_time -%>)
+  <br/>
+  <br/> 
   
   <% if !pending_deletions && !failed_deletions.empty? %>
     <p>