Merge branch 'main' into 18842-arv-mount-disk-config
[arvados.git] / apps / workbench / app / helpers / version_helper.rb
index 6cae78f53efc495f4a54797b39dc6e6e889492a3..d11071272b28728038710969543c5ec908d4e958 100644 (file)
@@ -1,30 +1,22 @@
-module VersionHelper
-  # 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:]].*/, '')
-  end
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
 
-  def api_version_text
+module VersionHelper
+  # Get the source_version given in the API server's discovery
+  # document.
+  def api_source_version
     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
-    Rails.configuration.source_version
-  end
-
-  def wb_version_text
-    wb_version + (Rails.configuration.local_modified or '')
+  # Get the packageVersion given in the API server's discovery
+  # document.
+  def api_package_version
+    arvados_api_client.discovery[:packageVersion]
   end
 
+  # URL for browsing source code for the given version.
   def version_link_target version
-    "https://arvados.org/projects/arvados/repository/changes?rev=#{version}"
+    "https://dev.arvados.org/projects/arvados/repository/changes?rev=#{version.sub(/-.*/, "")}"
   end
 end