add front page dashboard
authorTom Clegg <tom@clinicalfuture.com>
Wed, 12 Jun 2013 18:53:43 +0000 (14:53 -0400)
committerTom Clegg <tom@clinicalfuture.com>
Wed, 12 Jun 2013 18:53:43 +0000 (14:53 -0400)
apps/workbench/app/assets/javascripts/application.js
apps/workbench/app/controllers/users_controller.rb
apps/workbench/app/views/users/home.html.erb [new file with mode: 0644]
apps/workbench/config/routes.rb

index ca3ee33e5abbd2eec6d33bdb5d55293372374d60..9dd04c08021ea4b1f01abd7ae763603fd715058f 100644 (file)
@@ -24,4 +24,5 @@ jQuery(function($){
         }
     });
     $('.editable').editable();
+    $('[data-toggle=tooltip]').tooltip();
 })(jQuery);
index 3e74dea87f6c1d4315d3f8120bb87b404d13a14d..ef527a5591c45e1d1cc6abedc7754accf22e4af2 100644 (file)
@@ -1,2 +1,17 @@
 class UsersController < ApplicationController
+  skip_before_filter :find_object_by_uuid, :only => :welcome
+
+  def welcome
+    if current_user
+      redirect_to home_user_path(current_user.uuid)
+    else
+      redirect_to $arvados_api_client.arvados_login_url(return_to: request.url)
+    end
+  end
+
+  def home
+    @my_ssh_keys = AuthorizedKey.where(authorized_user: current_user.uuid)
+    @my_vm_perms = Link.where(tail_uuid: current_user.uuid, head_kind: 'arvados#virtual_machine', link_class: 'permission', name: 'can_login')
+    @my_repo_perms = Link.where(tail_uuid: current_user.uuid, head_kind: 'arvados#repository', link_class: 'permission', name: 'can_write')
+  end
 end
diff --git a/apps/workbench/app/views/users/home.html.erb b/apps/workbench/app/views/users/home.html.erb
new file mode 100644 (file)
index 0000000..2a69b06
--- /dev/null
@@ -0,0 +1,45 @@
+<div class="row-fluid">
+  <div class="col span4">
+    <h4>Setup</h4>
+    <div class="well">
+      <div>
+        <strong>SSH keys</strong>
+        <span class="badge <%= 'badge-success' if @my_ssh_keys.any? %> pull-right"><%= @my_ssh_keys.count %></span>
+      </div>
+      You&rsquo;ll use public key authentication when logging in to a
+      VM or use a hosted git repository.
+      <br />
+      <%= link_to raw('Add/edit keys &#x279c;'), authorized_keys_path, class: "btn #{'btn-primary' if @my_ssh_keys.empty?}" %>
+    </div>
+    <div class="well">
+      <div>
+        <strong>Virtual machines</strong>
+        <span class="badge <%= 'badge-success' if @my_vm_perms.any? %> pull-right"><%= @my_vm_perms.collect(&:head_uuid).uniq.count %></span>
+      </div>
+      Arvados includes virtual machines with SDKs installed and ready to use.
+      <br />
+      <% if @my_vm_perms.any? %>
+      <%= link_to raw('Show VMs &#x279c;'), virtual_machines_path, class: "btn" %>
+      <% elsif @my_ssh_keys.any? %>
+      <%= link_to raw('Request a VM &#x279c;'), virtual_machines_path, class: "btn btn-primary" %>
+      <% else %>
+      <%= link_to raw('Request a VM &#x279c;'), virtual_machines_path, { :class => "btn disabled", :"data-toggle" => "tooltip", :"data-placement" => "bottom", :title => "Add an SSH public key first!" } %>
+      <% end %>
+    </div>
+    <div class="well">
+      <div>
+        <strong>Git repositories</strong>
+        <span class="badge <%= 'badge-success' if @my_repo_perms.any? %> pull-right"><%= @my_repo_perms.collect(&:head_uuid).uniq.count %></span>
+      </div>
+      In order to run jobs using your own code, you need to push your code to a git repository. We provide hosted git repositories to make this easy.
+      <br />
+      <% if @my_repo_perms.any? %>
+      <%= link_to raw('Show repositories &#x279c;'), repositories_path, class: "btn" %>
+      <% elsif @my_ssh_keys.any? %>
+      <%= link_to raw('Request a repository &#x279c;'), repositories_path, class: "btn btn-primary" %>
+      <% else %>
+      <%= link_to raw('Request a repository &#x279c;'), repositories_path, { :class => "btn disabled", :"data-toggle" => "tooltip", :"data-placement" => "bottom", :title => "Add an SSH public key first!" } %>
+      <% end %>
+    </div>
+  </div>
+</div>
index 30ef4c2ee941f89d1c7b678569b927d62b1b33b2..b1c67137a8f8f7eba9ed33ff27b1fac1accdbc9a 100644 (file)
 ArvadosWorkbench::Application.routes.draw do
   resources :repositories
-
-
   resources :virtual_machines
-
-
   resources :authorized_keys
-
-
   resources :job_tasks
-
-
   resources :jobs
-
-
   match '/logout' => 'sessions#destroy'
   match '/logged_out' => 'sessions#index'
-
-
-  resources :users
-
-
+  resources :users do
+    get 'home', :on => :member
+    get 'welcome', :on => :collection
+  end
   resources :logs
-
-
   resources :factory_jobs
-  match '/factory_jobs/reset_pipeline_instance/:uuid' => 'factory_jobs#reset_pipeline_instance', :as => 'reset_pipeline_instance', :via => 'POST'
-
-
   resources :uploaded_datasets
-
-
   resources :groups
-
-
   resources :specimens
-
-
   resources :pipeline_templates
-
-
   resources :pipeline_instances
-
-
   resources :links
-
   match '/collections/graph' => 'collections#graph'
-
   resources :collections
-
-  root :to => 'collections#index'
+  root :to => 'users#welcome'
 
   # Send unroutable requests to an arbitrary controller
   # (ends up at ApplicationController#render_not_found)
   match '*a', :to => 'links#render_not_found'
-
-
-  # The priority is based upon order of creation:
-  # first created -> highest priority.
-
-  # Sample of regular route:
-  #   match 'products/:id' => 'catalog#view'
-  # Keep in mind you can assign values other than :controller and :action
-
-  # Sample of named route:
-  #   match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
-  # This route can be invoked with purchase_url(:id => product.id)
-
-  # Sample resource route (maps HTTP verbs to controller actions automatically):
-  #   resources :products
-
-  # Sample resource route with options:
-  #   resources :products do
-  #     member do
-  #       get 'short'
-  #       post 'toggle'
-  #     end
-  #
-  #     collection do
-  #       get 'sold'
-  #     end
-  #   end
-
-  # Sample resource route with sub-resources:
-  #   resources :products do
-  #     resources :comments, :sales
-  #     resource :seller
-  #   end
-
-  # Sample resource route with more complex sub-resources
-  #   resources :products do
-  #     resources :comments
-  #     resources :sales do
-  #       get 'recent', :on => :collection
-  #     end
-  #   end
-
-  # Sample resource route within a namespace:
-  #   namespace :admin do
-  #     # Directs /admin/products/* to Admin::ProductsController
-  #     # (app/controllers/admin/products_controller.rb)
-  #     resources :products
-  #   end
-
-  # You can have the root of your site routed with "root"
-  # just remember to delete public/index.html.
-  # root :to => 'welcome#index'
-
-  # See how all your routes lay out with "rake routes"
-
-  # This is a legacy wild controller route that's not recommended for RESTful applications.
-  # Note: This route will make all actions in every controller accessible via GET requests.
-  # match ':controller(/:action(/:id))(.:format)'
 end