4465: add API/Workbench Github links to help modal
authorTim Pierce <twp@curoverse.com>
Wed, 3 Dec 2014 16:56:08 +0000 (11:56 -0500)
committerTim Pierce <twp@curoverse.com>
Wed, 3 Dec 2014 17:00:35 +0000 (12:00 -0500)
Updated the help modal dialog to use the following links for API version
and Workbench version:

https://github.com/curoverse/arvados/tree/#{api_version}/services/api
https://github.com/curoverse/arvados/tree/#{wb_version}/apps/workbench

Refactored some code into a VersionHelper to simplify testing.

Also updated the Rails.configuration.source_version settings for both
API server and Workbench to strip trailing newlines (which were
screwing up the URLs).

apps/workbench/app/helpers/application_helper.rb
apps/workbench/app/helpers/version_helper.rb [new file with mode: 0644]
apps/workbench/app/views/application/_report_issue_popup.html.erb
apps/workbench/config/application.default.yml
apps/workbench/test/integration/report_issue_test.rb
services/api/config/application.default.yml

index c8c4ccc1a96a89facdbc580ab7f9c40eb7f80505..bc828c4f3818148de4ece0775003062470dfb97e 100644 (file)
@@ -1,4 +1,6 @@
 module ApplicationHelper
+  include VersionHelper
+
   def current_user
     controller.current_user
   end
diff --git a/apps/workbench/app/helpers/version_helper.rb b/apps/workbench/app/helpers/version_helper.rb
new file mode 100644 (file)
index 0000000..0d021fa
--- /dev/null
@@ -0,0 +1,17 @@
+module VersionHelper
+  include ArvadosApiClientHelper
+
+  def api_version()
+    arvados_api_client.discovery[:source_version]
+  end
+
+  def wb_version()
+    Rails.configuration.source_version
+  end
+
+  def wb_version_text()
+    wbv = wb_version
+    wbv += Rails.configuration.local_modified if Rails.configuration.local_modified
+    wbv
+  end
+end
index fe47fb08a5d0b355a83f90cd2f96abd9f3f7530c..4b2573742588bc6a7a9cefc2073b071ea1cd11d0 100644 (file)
@@ -1,11 +1,11 @@
 <%
-  api_version = arvados_api_client.discovery[:source_version]
   generated_at = arvados_api_client.discovery[:generatedAt]
-  wb_version = Rails.configuration.source_version
-  wb_version += Rails.configuration.local_modified if Rails.configuration.local_modified
   arvados_base = Rails.configuration.arvados_v1_base
   support_email = Rails.configuration.support_email_address
 
+  api_version_link = link_to api_version, "https://github.com/curoverse/arvados/tree/#{api_version}/services/api"
+  wb_version_link = link_to wb_version_text, "https://github.com/curoverse/arvados/tree/#{wb_version}/apps/workbench"
+
   additional_info = {}
   additional_info['Current location'] = params[:current_location]
   additional_info['User UUID'] = current_user.uuid if current_user
@@ -14,7 +14,7 @@
 
   additional_info['api_version'] = api_version
   additional_info['generated_at'] = generated_at
-  additional_info['workbench_version'] = wb_version
+  additional_info['workbench_version'] = wb_version_text
   additional_info['arvados_base'] = arvados_base
   additional_info['support_email'] = support_email
   additional_info['error_message'] = params[:error_message] if params[:error_message]
         <div class="form-group">
           <label for="wb_version" class="col-sm-4 control-label"> Workbench version </label>
           <div class="col-sm-8">
-            <p class="form-control-static" name="wb_version"><%=wb_version%></p>
+            <p class="form-control-static" name="wb_version"><%= wb_version_link %></p>
           </div>
         </div>
 
         <div class="form-group">
           <label for="server_version" class="col-sm-4 control-label"> API version </label>
           <div class="col-sm-8">
-            <p class="form-control-static" name="server_version"><%=api_version%></p>
+            <p class="form-control-static" name="server_version"><%= api_version_link %></p>
           </div>
         </div>
 
index 8d5c6160a526ee1bcd90a5f6380638c5e144c361..7e95bb359e9b95a2331432e9390be0aeb6ff2d68 100644 (file)
@@ -170,7 +170,7 @@ common:
   user_profile_form_message: Welcome to Arvados. All <span style="color:red">required fields</span> must be completed before you can proceed.
 
   # source_version
-  source_version: "<%= `git log -n 1 --format=%h` %>"
+  source_version: "<%= `git log -n 1 --format=%h`.strip %>"
   local_modified: false
 
   # report notification to and from addresses
index 4bf7d5747828a92f19130b5f9b1847b25a48a0f8..7eb65a22b814c564b123468399ae6605fb6d094b 100644 (file)
@@ -1,8 +1,11 @@
 require 'integration_helper'
 require 'selenium-webdriver'
 require 'headless'
+require_relative '../../app/helpers/version_helper'
 
 class ReportIssueTest < ActionDispatch::IntegrationTest
+  include VersionHelper
+
   setup do
     headless = Headless.new
     headless.start
@@ -35,6 +38,8 @@ class ReportIssueTest < ActionDispatch::IntegrationTest
       assert page.has_text?('Version / debugging info'), 'No text - Version / debugging info'
       assert page.has_no_text?('Report a problem'), 'Found text - Report a problem'
       assert page.has_no_text?('Describe the problem?'), 'Found text - Describe the problem'
+      assert page.has_link?(api_version), 'No link for API version'
+      assert page.has_link?(wb_version_text), 'No link for Workbench version'
       assert page.has_button?('Close'), 'No button - Close'
       assert page.has_no_button?('Send problem report'), 'Found button - Send problem report'
       click_button 'Close'
index cc46d042b2ca3787e379109b663f625532dc282f..253f12a3ef366ef2841bac85f06c0542d76d6609 100644 (file)
@@ -236,7 +236,7 @@ common:
   auto_setup_name_blacklist: [arvados, git, gitolite, gitolite-admin, root, syslog]
 
   # source_version
-  source_version: "<%= `git log -n 1 --format=%h` %>"
+  source_version: "<%= `git log -n 1 --format=%h`.strip %>"
   local_modified: false
 
   # Default lifetime for ephemeral collections: 2 weeks.