[ARVADOS] updated: 18c60ea458cb2a97c9d7318e702da8296e102466

git at public.curoverse.com git at public.curoverse.com
Mon Feb 3 03:47:33 EST 2014


Summary of changes:
 .../app/controllers/application_controller.rb      |    1 +
 apps/workbench/app/controllers/users_controller.rb |    6 +++++-
 apps/workbench/app/views/users/_home.html.erb      |    2 +-
 apps/workbench/app/views/users/_tables.html.erb    |    7 +++++++
 apps/workbench/app/views/users/home.js.erb         |    3 +++
 5 files changed, 17 insertions(+), 2 deletions(-)
 create mode 100644 apps/workbench/app/views/users/home.js.erb

       via  18c60ea458cb2a97c9d7318e702da8296e102466 (commit)
      from  507442f6712d751b947083fa6946ee6d96f8ad96 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 18c60ea458cb2a97c9d7318e702da8296e102466
Author: Tom Clegg <tom at curoverse.com>
Date:   Mon Feb 3 00:45:11 2014 -0800

    Refresh dashboard with AJAX every 60 seconds.
    
    refs #1976
    closes #2004

diff --git a/apps/workbench/app/controllers/application_controller.rb b/apps/workbench/app/controllers/application_controller.rb
index 6b9b6fc..6d013d7 100644
--- a/apps/workbench/app/controllers/application_controller.rb
+++ b/apps/workbench/app/controllers/application_controller.rb
@@ -1,4 +1,5 @@
 class ApplicationController < ActionController::Base
+  respond_to :html, :json, :js
   protect_from_forgery
   around_filter :thread_clear
   around_filter :thread_with_api_token, :except => [:render_exception, :render_not_found]
diff --git a/apps/workbench/app/controllers/users_controller.rb b/apps/workbench/app/controllers/users_controller.rb
index f9a74e2..70fa3f6 100644
--- a/apps/workbench/app/controllers/users_controller.rb
+++ b/apps/workbench/app/controllers/users_controller.rb
@@ -5,7 +5,7 @@ class UsersController < ApplicationController
 
   def welcome
     if current_user
-      redirect_to home_user_path(current_user.uuid)
+      home
     end
   end
 
@@ -53,5 +53,9 @@ class UsersController < ApplicationController
     @tutorial_complete = {
       'Run a job' => @my_last_job
     }
+    respond_to do |f|
+      f.js { render template: 'users/home.js' }
+      f.html { render template: 'users/home' }
+    end
   end
 end
diff --git a/apps/workbench/app/views/users/_home.html.erb b/apps/workbench/app/views/users/_home.html.erb
index f59e65e..16e8449 100644
--- a/apps/workbench/app/views/users/_home.html.erb
+++ b/apps/workbench/app/views/users/_home.html.erb
@@ -56,7 +56,7 @@
     <%= render :partial => 'notifications' %>
   </div>
   
-  <div class="span8">
+  <div class="span8" id="home-tables">
     <%= render :partial => 'tables' %>
   </div>
 
diff --git a/apps/workbench/app/views/users/_tables.html.erb b/apps/workbench/app/views/users/_tables.html.erb
index 3bf5023..bc9ffb6 100644
--- a/apps/workbench/app/views/users/_tables.html.erb
+++ b/apps/workbench/app/views/users/_tables.html.erb
@@ -1,6 +1,7 @@
 <% if current_user.andand.is_active %>
   <div>
     <strong>Recent jobs</strong>
+    <%= link_to '(refresh)', request.fullpath, class: 'refresh', remote: true, method: 'get' %>
     <%= link_to raw("Show all jobs →"), jobs_path, class: 'pull-right' %>
     <% if not current_user.andand.is_active or @my_jobs.empty? %>
       <p>(None)</p>
@@ -89,6 +90,7 @@
 
 <div>
   <strong>Recent pipeline instances</strong>
+  <%= link_to '(refresh)', request.fullpath, class: 'refresh', remote: true, method: 'get' %>
   <%= link_to raw("Show all pipeline instances →"), pipeline_instances_path, class: 'pull-right' %>
   <% if not current_user.andand.is_active or @my_pipelines.empty? %>
     <p>(None)</p>
@@ -143,6 +145,7 @@
 
 <div>
   <strong>Recent collections</strong>
+  <%= link_to '(refresh)', request.fullpath, class: 'refresh', remote: true, method: 'get' %>
   <%= link_to raw("Show all collections →"), collections_path, class: 'pull-right' %>
   <div class="pull-right" style="padding-right: 1em">
     <%= form_tag collections_path,
@@ -203,3 +206,7 @@
 <% else %>
   <%= image_tag "dax.png", style: "max-width=40%" %>
 <% end %>
+
+<% content_for :js do %>
+setInterval(function(){$('a.refresh:eq(0)').click()}, 60000);
+<% end %>
diff --git a/apps/workbench/app/views/users/home.js.erb b/apps/workbench/app/views/users/home.js.erb
new file mode 100644
index 0000000..d845186
--- /dev/null
+++ b/apps/workbench/app/views/users/home.js.erb
@@ -0,0 +1,3 @@
+var new_content = "<%= escape_javascript(render partial: 'tables') %>";
+if ($('div#home-tables').html() != new_content)
+   $('div#home-tables').html(new_content);

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list