Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ end

gemspec
#gem "omf_web", override_with_local(path: '../omf_web', git: 'git://github.com/mytestbed/omf_web', tag: 'v0.9.10')
gem "omf_web", override_with_local(path: '../omf_web', git: 'git://github.com/mytestbed/omf_web')
gem "omf_web", override_with_local(path: '../omf_web', git: 'git://github.com/mytestbed/omf_web', ref: 'fc3b04fb44c526eb330cf380c0b182705721140b')
gem "httparty"
gem "god"
gem 'rack-cors', :require => 'rack/cors'
Expand Down
17 changes: 7 additions & 10 deletions htdocs/theme/labwiki/js/exp_context.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ var ExpListView = Backbone.View.extend({
var select_slice = $('select[name="propslice"]');

select_project.change(function() {
exps.url = 'http://' + document.domain + ':8002/projects/' + select_project.val() + '/experiments';
exps.url = window.ges_url + '/projects/' + select_project.val() + '/experiments';
exps.fetch({reset: true});

var filtered_slices = _.find(geni_projects, function(proj) {
Expand All @@ -49,9 +49,11 @@ var ExpListView = Backbone.View.extend({
setupNewForm: function() {
$('#save-exp').on('click', function() {
new_exp = new Exp({ name: $('input#exp-name').val() });
new_exp.url = 'http://' + document.domain + ':8002/projects/' + $('select#project').val() +'/experiments';
new_exp.save();
exps.add(new_exp);
new_exp.url = window.ges_url + '/projects/' + $('select#project').val() +'/experiments';
new_exp.save({}, {
wait: true,
success: function() { exps.add(new_exp); }
});
});
},

Expand All @@ -66,9 +68,4 @@ var ExpListView = Backbone.View.extend({
}
});

$(function() {
if (typeof(window.exp_list) === "undefined") {
window.exp_list = new ExpListView();
}
window.exp_list.setupNewForm();
});

17 changes: 9 additions & 8 deletions lib/labwiki/plugin/plan_text/resource/css/plan_text.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ div.widget_body_plan p.content {

div.widget_body_plan p.drop-target {
height: 20px;
margin-bottom: 0px;
margin-bottom: 0px;
}

.plan_text strong {
Expand All @@ -23,33 +23,34 @@ div.widget_body_plan p.drop-target {
line-height: 1.3em;
}


.plan_text ul {
display: block;
list-style-type: disc;
list-style-position: inside !important;
}

.plan_text li {
.plan_text ul li {
list-style-type: disc;
list-style-position: inside !important;
display: list-item;
margin-left: 20;
margin-bottom: 10;
margin-bottom: 10;
}

/* .plan_text pre code { */
.plan_text pre {
.plan_text pre {
margin: 10;
padding: 10;
border: 1px solid rgba(0, 0, 0, 0.15)
}

.plan_text code {
.plan_text code {
border: 0;
padding: 0;
color: inherit;
background-color: transparent;
font-family: monospace;
line-height: 120%;
font-size: 14px;
line-height: 120%;
font-size: 14px;
}

2 changes: 1 addition & 1 deletion lib/labwiki/rack/plugin_resource_handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def initialize(cache_control = nil)

def _call(env)
@path_info = ::Rack::Utils.unescape(env["PATH_INFO"])
parts = @path_info.split SEPS
parts = @path_info.split ::Rack::Utils::PATH_SEPS
#puts ">>> PARTS: #{parts}"

return fail(403, "Forbidden") if parts.include? ".."
Expand Down
26 changes: 3 additions & 23 deletions lib/labwiki/session_init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def update_geni_projects_slices(user)
# We can create a default experiment for each project
if LabWiki::Configurator[:gimi] && LabWiki::Configurator[:gimi][:ges]
OMF::Web::SessionStore[:projects, :geni_portal].each do |p|
proj = find_or_create("projects", p[:name], { irods_user: OMF::Web::SessionStore[:id, :irods_user] })
proj = post_to_ges(p[:name], { name: p[:name], irods_user: OMF::Web::SessionStore[:id, :irods_user] })
end
end
end
Expand Down Expand Up @@ -175,28 +175,8 @@ def init_git_repository(id)
end
end

def find_or_create(res_path, res_id, additional_data = {})
def post_to_ges(project_name, additional_data = {})
ges_url = LabWiki::Configurator[:gimi][:ges]
obj = HTTParty.get("#{ges_url}/#{res_path}/#{res_id}")

if obj['uuid'].nil?
debug "Create a new #{res_path}"
obj = HTTParty.post("#{ges_url}/#{res_path}", body: { name: res_id }.merge(additional_data))
else
debug "Found existing #{res_path} #{obj['name']}"
# FIXME this hack appends irods user to projects
if res_path =~ /projects/
users = obj['irods_user'].split('|')
current_irods_user = OMF::Web::SessionStore[:id, :irods_user]
unless users.include? current_irods_user
new_irods_user = "#{obj['irods_user']}|#{current_irods_user}"
info "Need to write this #{new_irods_user}"
HTTParty.post("#{ges_url}/#{res_path}/#{res_id}", body: { irods_user: new_irods_user })
end
end
end

obj
HTTParty.post("#{ges_url}/projects/#{project_name}", body: additional_data)
end
end

85 changes: 51 additions & 34 deletions lib/labwiki/theme/page.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Page < OMF::Web::Theme::AbstractPage
#depends_on :js, "/resource/theme/labwiki/js/content_selector_widget.js"
#depends_on :js, "/resource/theme/labwiki/js/execute_col_controller.js"
#depends_on :js, "/resource/theme/labwiki/js/labwiki.js"
depends_on :js, "/resource/theme/labwiki/js/exp_context.js"
depends_on :js, "/resource/theme/labwiki/js/exp_context.js" if LabWiki::Configurator[:gimi] && LabWiki::Configurator[:gimi][:ges]

depends_on :js, "/resource/vendor/bootstrap/js/bootstrap.js"
depends_on :js, '/resource/vendor/jquery/jquery.js'
Expand Down Expand Up @@ -56,6 +56,18 @@ def content
#{gjsa.join("\n")}
});
}

javascript %{
$(function() {
window.ges_url = '#{LabWiki::Configurator[:gimi][:ges]}';

if (typeof(window.exp_list) === "undefined") {
window.exp_list = new ExpListView();
}
window.exp_list.setupNewForm();
});
} if LabWiki::Configurator[:gimi] && LabWiki::Configurator[:gimi][:ges]

div :id => "container", :style => "position: relative; height: 100%;" do
div :id => "k-window" do
div :id => "k-topbar" do
Expand Down Expand Up @@ -93,12 +105,15 @@ def content
end
end

li do
a :href => '#new-exp-modal', :role => 'button', :"data-toggle" => "modal" do
i :class => "icon-asterisk icon-white"
text "Add experiment context"
if LabWiki::Configurator[:gimi] && LabWiki::Configurator[:gimi][:ges]
li do
a :href => '#new-exp-modal', :role => 'button', :"data-toggle" => "modal" do
i :class => "icon-asterisk icon-white"
text "Add experiment context"
end
end
end

li do
a :href => '#', :class => 'user' do
i :class => "glyphicon glyphicon-user icon-white"
Expand All @@ -122,47 +137,49 @@ def content
end
end

div id: "new-exp-modal", class: "modal fade" do
div class: "modal-dialog" do
div class: "modal-content" do
if LabWiki::Configurator[:gimi] && LabWiki::Configurator[:gimi][:ges]
div id: "new-exp-modal", class: "modal fade" do
div class: "modal-dialog" do
div class: "modal-content" do

div class: "modal-header" do
button :type => "button", :class => "close", :"data-dismiss" => "modal", :"aria-hidden" => "true" do
rawtext '&times;'
div class: "modal-header" do
button :type => "button", :class => "close", :"data-dismiss" => "modal", :"aria-hidden" => "true" do
rawtext '&times;'
end
h3 "New experiment context", style: "font-size: 20px;"
end
h3 "New experiment context", style: "font-size: 20px;"
end

div class: "modal-body" do
form class: "form-horizontal", role: "form" do
div class: "form-group" do
label "Project", class: "col-sm-3 control-label"
div class: "col-sm-9" do
select id: "project", class: "form-control" do
if OMF::Web::SessionStore[:projects, :geni_portal]
OMF::Web::SessionStore[:projects, :geni_portal].each do |p|
option p[:name], value: p[:name]
div class: "modal-body" do
form class: "form-horizontal", role: "form" do
div class: "form-group" do
label "Project", class: "col-sm-3 control-label"
div class: "col-sm-9" do
select id: "project", class: "form-control" do
if OMF::Web::SessionStore[:projects, :geni_portal]
OMF::Web::SessionStore[:projects, :geni_portal].each do |p|
option p[:name], value: p[:name]
end
end
end
end
end
end

div class: "form-group" do
label class: "col-sm-3 control-label" do
text "Name"
end
div class: "col-sm-9" do
input id: "exp-name", type: "text", class: "form-control"
input id: "irods-user-name", type: "hidden", value: OMF::Web::SessionStore[:id, :user]
div class: "form-group" do
label class: "col-sm-3 control-label" do
text "Name"
end
div class: "col-sm-9" do
input id: "exp-name", type: "text", class: "form-control"
input id: "irods-user-name", type: "hidden", value: OMF::Web::SessionStore[:id, :user]
end
end
end
end
end

div class: "modal-footer" do
a "Close", :href => "#", :class => "btn btn-default", :"data-dismiss" => "modal"
a "Save", :href => "#", :id => "save-exp", :class => "btn btn-primary", :"data-dismiss" => "modal"
div class: "modal-footer" do
a "Close", :href => "#", :class => "btn btn-default", :"data-dismiss" => "modal"
a "Save", :href => "#", :id => "save-exp", :class => "btn btn-primary", :"data-dismiss" => "modal"
end
end
end
end
Expand Down