diff options
3 files changed, 10 insertions, 46 deletions
diff --git a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties index 6f5b7f63e5a..1d10da41bd9 100644 --- a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties +++ b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties @@ -601,22 +601,16 @@ manual_measures.pending_message=Pending measures are marked with orange box. The #------------------------------------------------------------------------------ project_history.page_title=Delete quality snapshots from project history -project_history.note=Note on snapshot deletion -project_history.note_detail=After deleting a snapshot, it is still possible to recover it as long as a new project analysis is not running or as long as the deleted snapshot has not been created more than 6 hours ago. project_history.col.year=Year project_history.col.month=Month project_history.col.time=Time project_history.col.events=Events project_history.col.action=Action project_history.delete=Delete -project_history.recover=Recover -project_history.currently_analysing=Currently analysing... project_history.last_snapshot=Last snapshot project_history.delete_snapshot=Delete snapshot -project_history.recover_snapshot=Recover snapshot project_history.snapshot_deleted=The snapshot will be deleted. -project_history.snapshot_recovered=Snapshot recovered. -project_history.snapshot_will_be_deleted_next_analysis=This snapshot will be deleted during next analysis. +project_history.are_you_sure_delete_snapshot_x=Are you sure you want to delete the snapshot created on "{0}"? #------------------------------------------------------------------------------ diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/project_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/project_controller.rb index cfd8080f773..29fc5cab8f7 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/project_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/project_controller.rb @@ -56,20 +56,18 @@ class ProjectController < ApplicationController end @snapshot=@project.last_snapshot - @snapshots = Snapshot.find(:all, :conditions => ["project_id=?", @project.id], + @snapshots = Snapshot.find(:all, :conditions => ["status='P' AND project_id=?", @project.id], :include => 'events', :order => 'snapshots.created_at DESC') end - def snapshot_history + def delete_snapshot_history project=Project.by_key(params[:id]) return access_denied unless is_admin?(@project) sid = params[:snapshot_id] - delete_operation = params[:operation] == "delete" if sid - status = delete_operation ? 'U' : 'P' - Snapshot.update_all("status='"+status+"'", ["id=? or root_snapshot_id=(?)", sid, sid]) - flash[:notice] = message(delete_operation ? 'project_history.snapshot_deleted' : 'project_history.snapshot_recovered') + Snapshot.update_all("status='U'", ["id=? or root_snapshot_id=(?)", sid, sid]) + flash[:notice] = message('project_history.snapshot_deleted') end redirect_to :action => 'history', :id => project.id diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/project/history.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/project/history.html.erb index e411332d50a..4c8dc6235b1 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/project/history.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/project/history.html.erb @@ -2,22 +2,13 @@ <h1><%= message('project_history.page_title') -%></h1> <br/> -<div class="help"> - <h3><%= message('project_history.note') -%></h3> - <p> - <%= message('project_history.note_detail') -%> - </p> -</div> -<br/> - <table class="data" style="width:1%"> <thead> <tr> <th class="thin nowrap"><%= message('project_history.col.year') -%></th> <th class="thin nowrap"><%= message('project_history.col.month') -%></th> <th class="thin nowrap" style="padding-left: 20px;"><%= message('project_history.col.events') -%></th> - <th style="min-width: 20px; padding-left: 30px;"> </th> - <th class="thin nowrap"><%= message('project_history.col.time') -%></th> + <th class="thin nowrap" style="padding-left: 20px;"><%= message('project_history.col.time') -%></th> <th class="thin nowrap center"><%= message('project_history.col.action') -%></th> </tr> </thead> @@ -25,7 +16,6 @@ <% current_year = nil current_month = nil - last_snapshot_found = false @snapshots.each do |snapshot| number_of_events = snapshot.events.size time = snapshot.created_at @@ -36,35 +26,17 @@ <td class="thin nowrap" style="padding-left: 20px;"> <%= snapshot.events.map{|e| e.name}.join(', ') -%> </td> - <td class="right" style="padding-left: 30px;"> - <% if last_snapshot_found && snapshot.status == 'U' %> - <img src="<%= image_path '/images/exclamation.png' -%>" title="<%= message('project_history.snapshot_will_be_deleted_next_analysis') -%>"> - <% end %> - </td> - <td class="thin nowrap"><%= l time, :format => :long -%></td> + <td class="thin nowrap" style="padding-left: 20px;"><%= l time, :format => :long -%></td> <td class="thin nowrap center" style="padding-left:10px; padding-right:10px"> <% cell_content = nil; if snapshot.islast? - last_snapshot_found = true cell_content = "<b>" + message('project_history.last_snapshot') + "</b>" - elsif !last_snapshot_found - # the current snapshot is older than the last snapshot (the one that #islast == true), so this means that it represents - # an analysis that is currently running => no action should be taken - cell_content = "<i>" + message('project_history.currently_analysing') + "</i>" else - # this is a past snapshot, let's see if it could be deleted or recovered - if snapshot.status == 'P' - cell_content = button_to( message('project_history.delete_snapshot'), - { :action => "snapshot_history", :id => @project.id, :snapshot_id => [snapshot.id], :operation => "delete" }, + cell_content = button_to( message('project_history.delete_snapshot'), + { :action => "delete_snapshot_history", :id => @project.id, :snapshot_id => [snapshot.id] }, :class => 'action red-button', - :method => :delete) - else - cell_content = button_to( message('project_history.recover_snapshot'), - { :action => "snapshot_history", :id => @project.id, :snapshot_id => [snapshot.id], :operation => "recover" }, - :class => 'action', - :method => :delete) - end + :confirm => message('project_history.are_you_sure_delete_snapshot_x', :params => l(time, :format => :long)) ) end %> <%= cell_content -%> |