From e16f49f1397ce88a9e27fba6dda306d2c882caa1 Mon Sep 17 00:00:00 2001 From: Jack C Hong Date: Fri, 30 May 2014 17:16:12 +1000 Subject: [PATCH 1/8] Need to handle geni accounts don't have irods account --- lib/labwiki/session_init.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/labwiki/session_init.rb b/lib/labwiki/session_init.rb index cca5034..736475e 100644 --- a/lib/labwiki/session_init.rb +++ b/lib/labwiki/session_init.rb @@ -188,7 +188,7 @@ def find_or_create(res_path, res_id, additional_data = {}) if res_path =~ /projects/ users = obj['irods_user'].split('|') current_irods_user = OMF::Web::SessionStore[:id, :irods_user] - unless users.include? current_irods_user + unless current_irods_user.to_s == "" || 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 }) From 22d6024140681d1768a5585db7c1c701016d69cd Mon Sep 17 00:00:00 2001 From: Jack C Hong Date: Mon, 2 Jun 2014 14:23:36 +1000 Subject: [PATCH 2/8] Syntax error fixed to previous commit --- lib/labwiki/session_init.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/labwiki/session_init.rb b/lib/labwiki/session_init.rb index 736475e..da235e9 100644 --- a/lib/labwiki/session_init.rb +++ b/lib/labwiki/session_init.rb @@ -188,7 +188,7 @@ def find_or_create(res_path, res_id, additional_data = {}) if res_path =~ /projects/ users = obj['irods_user'].split('|') current_irods_user = OMF::Web::SessionStore[:id, :irods_user] - unless current_irods_user.to_s == "" || users.include? current_irods_user + unless current_irods_user.to_s == "" || 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 }) From baef7fd3de55f7b963d994ea3bb5854d6b1d62f2 Mon Sep 17 00:00:00 2001 From: Jack C Hong Date: Thu, 3 Jul 2014 12:43:16 +1000 Subject: [PATCH 3/8] Record omf_web version that works with this branch --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 4bd5a83..abb300d 100644 --- a/Gemfile +++ b/Gemfile @@ -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' From 7ade54c77406d93be49e122ecf16617c9fa0ec74 Mon Sep 17 00:00:00 2001 From: Jack C Hong Date: Fri, 4 Jul 2014 13:24:52 +1000 Subject: [PATCH 4/8] Simplify post irods user to ges due to ges refactoring refs #1792 LW hangs for individual users and logs shows Timeout Error. requires ges upgraded to 410d5e2 --- lib/labwiki/session_init.rb | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a/lib/labwiki/session_init.rb b/lib/labwiki/session_init.rb index da235e9..c47762f 100644 --- a/lib/labwiki/session_init.rb +++ b/lib/labwiki/session_init.rb @@ -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 @@ -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 current_irods_user.to_s == "" || 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 - From e7d1eedd0d8a216eefa40ca7b3407efc408b2e1a Mon Sep 17 00:00:00 2001 From: Jack C Hong Date: Thu, 19 Jun 2014 16:32:02 +1000 Subject: [PATCH 5/8] Render list in markdown correctly --- .../plan_text/resource/css/plan_text.css | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/lib/labwiki/plugin/plan_text/resource/css/plan_text.css b/lib/labwiki/plugin/plan_text/resource/css/plan_text.css index fea8d41..2d4a627 100644 --- a/lib/labwiki/plugin/plan_text/resource/css/plan_text.css +++ b/lib/labwiki/plugin/plan_text/resource/css/plan_text.css @@ -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 { @@ -23,33 +23,32 @@ div.widget_body_plan p.drop-target { line-height: 1.3em; } - .plan_text ul { display: block; - list-style-type: disc; + list-style: disc inside; } -.plan_text li { - list-style-type: disc; +.plan_text ul li { + list-style: disc inside; 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; } From bc38f3297b8d1a23a954ee8ca0fc5ea3f3eded09 Mon Sep 17 00:00:00 2001 From: Jack C Hong Date: Wed, 16 Jul 2014 17:41:03 +1000 Subject: [PATCH 6/8] Not sure why li position has been overwritten somewhere --- lib/labwiki/plugin/plan_text/resource/css/plan_text.css | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/labwiki/plugin/plan_text/resource/css/plan_text.css b/lib/labwiki/plugin/plan_text/resource/css/plan_text.css index 2d4a627..6950848 100644 --- a/lib/labwiki/plugin/plan_text/resource/css/plan_text.css +++ b/lib/labwiki/plugin/plan_text/resource/css/plan_text.css @@ -25,11 +25,13 @@ div.widget_body_plan p.drop-target { .plan_text ul { display: block; - list-style: disc inside; + list-style-type: disc; + list-style-position: inside !important; } .plan_text ul li { - list-style: disc inside; + list-style-type: disc; + list-style-position: inside !important; display: list-item; margin-left: 20; margin-bottom: 10; From 96fb80b7233f2da92ef41389ea141a943ca267e3 Mon Sep 17 00:00:00 2001 From: Jack C Hong Date: Wed, 13 Aug 2014 18:02:52 +1000 Subject: [PATCH 7/8] IRODS path NOT correct in production JS for new projects fixes #1846 --- htdocs/theme/labwiki/js/exp_context.js | 17 +++--- lib/labwiki/theme/page.rb | 85 +++++++++++++++----------- 2 files changed, 58 insertions(+), 44 deletions(-) diff --git a/htdocs/theme/labwiki/js/exp_context.js b/htdocs/theme/labwiki/js/exp_context.js index bce799a..23fa2fa 100644 --- a/htdocs/theme/labwiki/js/exp_context.js +++ b/htdocs/theme/labwiki/js/exp_context.js @@ -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) { @@ -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); } + }); }); }, @@ -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(); -}); + diff --git a/lib/labwiki/theme/page.rb b/lib/labwiki/theme/page.rb index bfaaca9..9cd23d9 100644 --- a/lib/labwiki/theme/page.rb +++ b/lib/labwiki/theme/page.rb @@ -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' @@ -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 @@ -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" @@ -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 '×' + div class: "modal-header" do + button :type => "button", :class => "close", :"data-dismiss" => "modal", :"aria-hidden" => "true" do + rawtext '×' + 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 From 2129d97f7bf98a4bec45b31915002150ada5ad3a Mon Sep 17 00:00:00 2001 From: thierry Date: Mon, 12 Jan 2015 11:54:23 +1100 Subject: [PATCH 8/8] Replaced SEPS by PATH_SEPS as a result of Rack 1.6.0 upgrade, #1883 --- lib/labwiki/rack/plugin_resource_handler.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/labwiki/rack/plugin_resource_handler.rb b/lib/labwiki/rack/plugin_resource_handler.rb index 0ca1d05..13ce8c0 100644 --- a/lib/labwiki/rack/plugin_resource_handler.rb +++ b/lib/labwiki/rack/plugin_resource_handler.rb @@ -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? ".."