gem 'passenger', :group => :production
gem 'andand'
+gem 'RedCloth'
GEM
remote: https://rubygems.org/
specs:
+ RedCloth (4.2.9)
actionmailer (3.2.11)
actionpack (= 3.2.11)
mail (~> 2.4.4)
ruby
DEPENDENCIES
+ RedCloth
andand
anjlab-bootstrap-rails (>= 2.2)
bootstrap-editable-rails
end
end
+ def render_content
+ if !@object
+ return render_not_found("object not found")
+ end
+ end
+
def new
@object = model_class.new
end
end
def home
- @my_ssh_keys = AuthorizedKey.where(authorized_user: current_user.uuid)
+ @my_ssh_keys = AuthorizedKey.where(authorized_user_uuid: 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')
+ @my_last_job = Job.
+ limit(1).
+ order(:created_at).
+ where(created_by: current_user.uuid).
+ last
+
+ # A Tutorial is a Link which has link_class "resources" and name
+ # "wants", and is owned by the Tutorials Group (i.e., named
+ # "Arvados Tutorials" and owned by the system user).
+ @tutorial_group = Group.where(owner: User.system.uuid,
+ name: 'Arvados Tutorials').first
+ if @tutorial_group
+ @tutorial_links = Link.where(tail_uuid: @tutorial_group.uuid,
+ link_class: 'resources',
+ name: 'wants')
+ else
+ @tutorial_links = []
+ end
+ @tutorial_complete = {
+ 'Run a job' => @my_last_job
+ }
end
end
def current_user
controller.current_user
end
+
+ def render_content_from_database(markup)
+ raw RedCloth.new(markup).to_html
+ end
+
def human_readable_bytes_html(n)
return h(n) unless n.is_a? Fixnum
raw = n.to_s
end
new.private_reload(uuid)
end
+ def self.order(*args)
+ ArvadosResourceList.new(self).order(*args)
+ end
def self.where(*args)
ArvadosResourceList.new(self).where(*args)
end
self
end
+ def order(orderby_spec)
+ @orderby_spec = orderby_spec
+ self
+ end
+
def where(cond)
cond = cond.dup
cond.keys.each do |uuid_key|
}
api_params[:eager] = '1' if @eager
api_params[:limit] = @limit if @limit
+ api_params[:order] = @orderby_spec if @orderby_spec
res = $arvados_api_client.api @resource_class, '', api_params
@results = $arvados_api_client.unpack_api_response res
self
$arvados_api_client.unpack_api_response(res)
end
+ def self.system
+ $arvados_system_user ||= begin
+ res = $arvados_api_client.api self, '/system'
+ $arvados_api_client.unpack_api_response(res)
+ end
+ end
+
def full_name
(self.first_name || "") + " " + (self.last_name || "")
end
+<% content_for :arvados_object_table do %>
<%= form_for @object do |f| %>
<table class="table topalign">
<thead>
</tbody>
</table>
<% end %>
+<% end %>
+
+<% if content_for? :page_content %>
+<%= yield :page_content %>
+<% else %>
+<%= yield :arvados_object_table %>
+<% end %>
<div>
<ul class="nav nav-tabs">
+ <% if content_for? :page_content %>
+ <li><a href="#arvados-object-table" data-toggle="tab">Table</a></li>
+ <% end %>
<li class="active"><a href="#arvados-object-json" data-toggle="tab">JSON</a></li>
<% if @object.andand.uuid %>
<li><a href="#arvados-object-curl" data-toggle="tab">CLI update</a></li>
<% end %>
</ul>
<div class="tab-content">
+ <% if content_for? :page_content %>
+ <div id="arvados-object-table" class="tab-pane fade">
+ <%= yield :arvados_object_table %>
+ </div>
+ <% end %>
<div id="arvados-object-json" class="tab-pane fade in active">
<pre>
<%= JSON.pretty_generate(@object.attributes.reject { |k,v| k == 'id' }) rescue nil %>
+<% if @object.respond_to? :properties %>
+
+<% content_for :page_title do %>
+<%= @object.properties[:page_title] || @object.uuid %>
+<% end %>
+
+<% if @object.properties[:page_content] %>
+<% content_for :page_content do %>
+<h1>
+<%= render_content_from_database(@object.properties[:page_title] || @object.uuid) %>
+</h1>
+
+<% if @object.properties[:page_subtitle] %>
+<h4>
+<%= render_content_from_database @object.properties[:page_subtitle] %>
+</h4>
+<% end %>
+
+<%= render_content_from_database @object.properties[:page_content] %>
+<% end %>
+<% end %>
+<% end %>
+
+
<%= render :partial => 'application/arvados_object' %>
<html>
<head>
<meta charset="utf-8">
- <title><%= Rails.configuration.site_name rescue Rails.application.class.parent_name %></title>
+ <title>
+ <% if content_for? :page_title %>
+ <%= yield :page_title %>
+ <% else %>
+ <%= Rails.configuration.site_name rescue Rails.application.class.parent_name %>
+ <% end %>
+ </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
+<% if @tutorial_links.any? %>
+<% content_for :tutorials do %>
+<h4>Tutorials</h4>
+<% @tutorial_links.each do |tut| %>
+<div class="well clearfix">
+ <div>
+ <strong><%= tut.properties[:page_title] %></strong>
+ <% if @tutorial_complete[tut.properties[:page_title]] %>
+ <span class="badge badge-success pull-right">✔</span>
+ <% else %>
+ <span class="badge pull-right">✍</span>
+ <% end %>
+ </div>
+ <%= render_content_from_database tut.properties[:page_subtitle] %>
+ <br />
+ <%= link_to raw('Tutorial: ' + tut.properties[:page_title] + ' ➜'), link_path(tut.uuid), class: "pull-right btn btn-primary" %>
+</div>
+<% end %>
+<% end %>
+<% end %>
+
+<% content_for :references do %>
+<h4>References</h4>
+<div class="well clearfix">
+ <div>
+ <strong>API Reference</strong>
+ </div>
+ API calls for running jobs, building pipelines, and developing apps.
+ <br />
+ <%= link_to raw('API Reference ➜'), 'http://doc.arvados.org/api/', class: "pull-right btn" %>
+</div>
+<div class="well clearfix">
+ <div>
+ <strong>User Guide</strong>
+ </div>
+ Getting acquainted with the Arvados platform.
+ <br />
+ <%= link_to raw('User Guide ➜'), 'http://doc.arvados.org/user/', class: "pull-right btn" %>
+</div>
+<div class="well clearfix">
+ <div>
+ <strong>arvados.org</strong>
+ </div>
+ Project home page: developer docs, source code, background.
+ <br />
+ <%= link_to raw('arvados.org ➜'), 'https://arvados.org/', class: "pull-right btn" %>
+</div>
+<% end %>
+
<div class="row-fluid">
<div class="col span4">
<h4>Setup</h4>
- <div class="well">
+ <div class="well clearfix">
<div>
<strong>SSH keys</strong>
<span class="badge <%= 'badge-success' if @my_ssh_keys.any? %> pull-right"><%= @my_ssh_keys.count %></span>
You’ll use public key authentication when logging in to a
VM or use a hosted git repository.
<br />
- <%= link_to raw('Add/edit keys ➜'), authorized_keys_path, class: "btn #{'btn-primary' if @my_ssh_keys.empty?}" %>
+ <%= link_to raw('Add/edit keys ➜'), authorized_keys_path, class: "pull-right btn #{'btn-primary' if @my_ssh_keys.empty?}" %>
</div>
- <div class="well">
+ <div class="well clearfix">
<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>
Arvados includes virtual machines with SDKs installed and ready to use.
<br />
<% if @my_vm_perms.any? %>
- <%= link_to raw('Show VMs ➜'), virtual_machines_path, class: "btn" %>
+ <%= link_to raw('Show VMs ➜'), virtual_machines_path, class: "pull-right btn" %>
<% elsif @my_ssh_keys.any? %>
- <%= link_to raw('Request a VM ➜'), virtual_machines_path, class: "btn btn-primary" %>
+ <%= link_to raw('Request a VM ➜'), virtual_machines_path, class: "pull-right btn btn-primary" %>
<% else %>
- <%= link_to raw('Request a VM ➜'), virtual_machines_path, { :class => "btn disabled", :"data-toggle" => "tooltip", :"data-placement" => "bottom", :title => "Add an SSH public key first!" } %>
+ <%= link_to raw('Request a VM ➜'), virtual_machines_path, { :class => "pull-right btn disabled", :"data-toggle" => "tooltip", :"data-placement" => "bottom", :title => "Add an SSH public key first!" } %>
<% end %>
</div>
- <div class="well">
+ <div class="well clearfix">
<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>
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 ➜'), repositories_path, class: "btn" %>
+ <%= link_to raw('Show repositories ➜'), repositories_path, class: "pull-right btn" %>
<% elsif @my_ssh_keys.any? %>
- <%= link_to raw('Request a repository ➜'), repositories_path, class: "btn btn-primary" %>
+ <%= link_to raw('Request a repository ➜'), repositories_path, class: "pull-right btn btn-primary" %>
<% else %>
- <%= link_to raw('Request a repository ➜'), repositories_path, { :class => "btn disabled", :"data-toggle" => "tooltip", :"data-placement" => "bottom", :title => "Add an SSH public key first!" } %>
+ <%= link_to raw('Request a repository ➜'), repositories_path, { :class => "pull-right btn disabled", :"data-toggle" => "tooltip", :"data-placement" => "bottom", :title => "Add an SSH public key first!" } %>
<% end %>
</div>
</div>
+
+ <% if content_for? :tutorials %>
+ <div class="col span4">
+ <%= yield :tutorials %>
+ </div>
+ <% end %>
+
+ <div class="col span4">
+ <%= yield :references %>
+ </div>
</div>
1. [Install the Arvados REST API server](install-api-server.html)
1. [Install the Arvados workbench application](install-workbench-app.html)
1. Set up the Job manager
+1. Create a Group named "Arvados Tutorials", owned by the system user. Create Links (link_class "resources", name "wants") from the tutorials group to sample data collections. Edit <code>page_content</code>, <code>page_title</code>, and <code>page_subtitle</code> properties to suit. These will be listed in the Tutorials section of your users' home pages.
@object = current_user
show
end
+ def system
+ @object = system_user
+ show
+ end
end
module ApplicationHelper
- def current_user
- controller.current_user
- end
-
- def act_as_system_user
- if not $system_user
- Thread.current[:user] = User.new(is_admin: true)
- sysuser_id = [Server::Application.config.uuid_prefix,
- User.uuid_prefix,
- '000000000000000'].join('-')
- $system_user = User.where('uuid=?', sysuser_id).first
- if !$system_user
- $system_user = User.new(uuid: sysuser_id,
- is_admin: true,
- email: 'root',
- first_name: 'root',
- last_name: '')
- $system_user.save!
- $system_user.reload
- end
- end
- Thread.current[:user] = $system_user
- end
+ include CurrentApiClient
end
match '/keep_disks/ping' => 'keep_disks#ping', :as => :ping_keep_disk
match '/links/from/:tail_uuid' => 'links#index', :as => :arvados_v1_links_from
match '/users/current' => 'users#current'
+ match '/users/system' => 'users#system'
match '/jobs/queue' => 'jobs#queue'
match '/virtual_machines/get_all_logins' => 'virtual_machines#get_all_logins'
match '/repositories/get_all_permissions' => 'repositories#get_all_permissions'
def current_api_client_trusted
Thread.current[:api_client_trusted]
end
+
+ def system_user_uuid
+ [Server::Application.config.uuid_prefix,
+ User.uuid_prefix,
+ '000000000000000'].join('-')
+ end
+
+ def system_user
+ if not $system_user
+ real_current_user = Thread.current[:user]
+ Thread.current[:user] = User.new(is_admin: true)
+ $system_user = User.where('uuid=?', system_user_uuid).first
+ if !$system_user
+ $system_user = User.new(uuid: system_user_uuid,
+ is_admin: true,
+ email: 'root',
+ first_name: 'root',
+ last_name: '')
+ $system_user.save!
+ $system_user.reload
+ end
+ Thread.current[:user] = real_current_user
+ end
+ $system_user
+ end
+
+ def act_as_system_user
+ Thread.current[:user] = system_user
+ end
end