4465: Link to arvados.org revision history instead of github.com code view.
authorTom Clegg <tom@curoverse.com>
Fri, 5 Dec 2014 06:49:26 +0000 (01:49 -0500)
committerTom Clegg <tom@curoverse.com>
Fri, 5 Dec 2014 06:49:26 +0000 (01:49 -0500)
Also, remove spurious helper inclusions, and fix 'locally modified'
detection (it was broken because "" is truthy).

refs #4465

apps/workbench/app/helpers/application_helper.rb
apps/workbench/app/helpers/version_helper.rb
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 e003b2cb0ab9d5e86ddd73ff3bb5093c6ac51f4a..f1502afee10cf02edece673f9d05c26275ee3fcc 100644 (file)
@@ -1,6 +1,4 @@
 module ApplicationHelper
-  include VersionHelper
-
   def current_user
     controller.current_user
   end
index 54470ae395556927d41645504ae14b987b844c42..6cae78f53efc495f4a54797b39dc6e6e889492a3 100644 (file)
@@ -1,29 +1,30 @@
 module VersionHelper
-  include ArvadosApiClientHelper
+  # api_version returns the git commit hash for the API server's
+  # current version.  It is extracted from api_version_text, which
+  # returns the source_version provided by the discovery document and
+  # may have the word "-modified" appended to it (if the API server is
+  # running from a locally modified repository).
 
-  # api_version returns the git commit hash for the API server's current version.
-  # It is extracted from api_version_text, which returns the source_version provided
-  # by the discovery document and may have the word "-modified" appended to it (if
-  # the API server is running from a locally modified repository).
-
-  def api_version()
-    api_version_text().sub(/[^[:xdigit:]].*/, '')
+  def api_version
+    api_version_text.sub(/[^[:xdigit:]].*/, '')
   end
 
-  def api_version_text()
+  def api_version_text
     arvados_api_client.discovery[:source_version]
   end
 
   # wb_version and wb_version_text provide the same strings for the
   # code version that this Workbench is currently running.
 
-  def wb_version()
+  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
+  def wb_version_text
+    wb_version + (Rails.configuration.local_modified or '')
+  end
+
+  def version_link_target version
+    "https://arvados.org/projects/arvados/repository/changes?rev=#{version}"
   end
 end
index 705ddffe11c2242bd68a2cd7228034758a3e8b15..315116bbc8926e1c8dfd9953a8bf32561b575090 100644 (file)
@@ -3,8 +3,8 @@
   arvados_base = Rails.configuration.arvados_v1_base
   support_email = Rails.configuration.support_email_address
 
-  api_version_link = link_to api_version_text, "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"
+  api_version_link = link_to api_version_text, version_link_target(api_version)
+  wb_version_link = link_to wb_version_text, version_link_target(wb_version)
 
   additional_info = {}
   additional_info['Current location'] = params[:current_location]
index 7e95bb359e9b95a2331432e9390be0aeb6ff2d68..b485276c09ad598353169c6c045405c6a981191b 100644 (file)
@@ -38,7 +38,7 @@ development:
   assets.debug: true
   profiling_enabled: true
   site_name: Arvados Workbench (dev)
-  local_modified: <%= '-modified' if `git status -s` %>
+  local_modified: "<%= '-modified' if `git status -s` != '' %>"
 
   # API server configuration
   arvados_login_base: ~
index 3af7f922a31e2d93b2bf5e27591bdda9768d353f..ac9e596f8cb65053b6a217646757c5db2288ad80 100644 (file)
@@ -37,10 +37,12 @@ class ReportIssueTest < ActionDispatch::IntegrationTest
       assert page.has_no_text?('Describe the problem?'), 'Found text - Describe the problem'
       assert page.has_button?('Close'), 'No button - Close'
       assert page.has_no_button?('Send problem report'), 'Found button - Send problem report'
-      api_version_rgx = %r!^https://github.com/curoverse/arvados/tree/[0-9a-f]+/services/api/?$!
-      wb_version_rgx = %r!^https://github.com/curoverse/arvados/tree/[0-9a-f]+/apps/workbench/?$!
-      assert_not_empty(all("a").select { |a| a[:href] =~ wb_version_rgx })
-      assert_not_empty(all("a").select { |a| a[:href] =~ api_version_rgx })
+      history_links = all('a').select do |a|
+        a[:href] =~ %r!^https://arvados.org/projects/arvados/repository/changes\?rev=[0-9a-f]+$!
+      end
+      assert_operator(2, :<=, history_links.count,
+                      "Should have found two links to revision history " +
+                      "in #{history_links.inspect}")
       click_button 'Close'
     end
 
index 253f12a3ef366ef2841bac85f06c0542d76d6609..fb94402f9908e42737c1a52ded98ed40f05541ca 100644 (file)
@@ -15,7 +15,7 @@ development:
   active_record.auto_explain_threshold_in_seconds: 0.5
   assets.compress: false
   assets.debug: true
-  local_modified: <%= '-modified' if `git status -s` %>
+  local_modified: "<%= '-modified' if `git status -s` != '' %>"
 
 production:
   force_ssl: true