Skip to content

Commit

Permalink
[webui] show running patchinfos to the user (not tested yet)
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianschroeter committed Jan 4, 2012
1 parent 2b0ad74 commit de2d823
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/webui/app/controllers/home_controller.rb
Expand Up @@ -12,6 +12,7 @@ def my_work
user = find_cached(Person, params['user'] ) if params['user']
@user = user if user
@declined_requests, @open_reviews, @new_requests = @user.requests_that_need_work(:cache => false)
@open_patchinfos = @user.running_patchinfos(:cache => false)
end

def requests
Expand Down
8 changes: 8 additions & 0 deletions src/webui/app/models/person.rb
Expand Up @@ -138,6 +138,14 @@ def involved_requests(opts = {})
end
end

def running_patchinfos(opts = {})
cachekey = "#{login}_patchinfos_that_need_work"
Rails.cache.delete cachekey unless opts[:cache]
return Rails.cache.fetch(cachekey, :expires_in => 10.minutes) do
Collection.find_cached(:id, :what => 'package', :predicate => "patchinfo/issue/owner/@login='#{login}'")
end
end

# Returns a tuple (i.e., array) of open requests and open reviews.
def requests_that_need_work(opts = {})
opts = {:cache => true}.merge opts
Expand Down
28 changes: 25 additions & 3 deletions src/webui/app/views/home/my_work.html.erb
Expand Up @@ -9,19 +9,41 @@
<h3><%= @pagetitle %></h3>

<p>
This page summarizes all requests where immediate action is required from you.
This page summarizes all tasks where an action is requested from you.
<%= link_to('You can also use your complete list of requests.', :action => 'requests', :user => user.to_s) %>
</p>

<!-- patchinfos which are still running -->
<% if @open_patchinfos.count %>
<h3 title="Maintenance updates where you are assigned as bugowner">Running Maintenance Updates</h3>
<table style="width: 92%" id='open_patchinfos-table' class='grid' title="Running Maintenance Updates">
<tr>
<th>Project</th>
<th>Package</th>
<th style="width: 1%">Actions</th>
</tr>
<% @open_patchinfos.each do |prj, packs| -%>
<% packs.each do |pkg| -%>
<tr>
<% shortened_prj, shortened_pkg = elide_two(prj, pkg, 60) %>
<td><%= link_to shortened_prj, :controller => :project, :action => :show, :project => prj %></td>
<td><%= link_to shortened_pkg, :controller => :package, :action => :show, :project => prj, :package => pkg %></td>
<td><%= link_to image_tag('monitor.png', :size => '16x16', :alt => 'Monitor', :title => 'Monitor'), :action => :monitor, :project => prj, :pkgname => pkg, :controller => :project %></td>
</tr>
<% end -%>
<% end -%>
</table>
<% end -%>
<% if @open_reviews.count > 0 %>
<h3 title="Someone asks you to review a change.">Open Reviews</h3>
<%= render(:partial => 'shared/requests', :locals => { :requests => @open_reviews }) %>
<%= render(:partial => 'shared/requests', :locals => { :requests => @open_reviews, :request_table_id => 'new_reviews_table' }) %>
<% end %>

<h3 title="Someone requests to change something in your packages.">New Requests For You</h3>
<%= render(:partial => 'shared/requests', :locals => { :requests => @new_requests, :request_table_id => 'new_requests_table' }) %>
<% if @declined_requests.count > 0 %>
<h3 title="Some other party has declined a request you created.">Your Declined Requests</h3>
<%= render(:partial => 'shared/requests', :locals => { :requests => @declined_requests, :request_table_id => 'deleted_requests_table' }) %>
<%= render(:partial => 'shared/requests', :locals => { :requests => @declined_requests, :request_table_id => 'declined_requests_table' }) %>
<% end %>

0 comments on commit de2d823

Please sign in to comment.