You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ja...@apache.org on 2017/02/17 10:09:26 UTC

lucene-solr:master: SOLR-9584: Use relative URLs also for files and query

Repository: lucene-solr
Updated Branches:
  refs/heads/master 7a8c59dd8 -> bd459c127


SOLR-9584: Use relative URLs also for files and query


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/bd459c12
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/bd459c12
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/bd459c12

Branch: refs/heads/master
Commit: bd459c12756635450512e95c6d0ee92697c64e5f
Parents: 7a8c59d
Author: Jan H�ydahl <ja...@apache.org>
Authored: Fri Feb 17 10:45:10 2017 +0100
Committer: Jan H�ydahl <ja...@apache.org>
Committed: Fri Feb 17 11:08:20 2017 +0100

----------------------------------------------------------------------
 solr/CHANGES.txt                                | 7 ++++---
 solr/webapp/web/js/angular/controllers/files.js | 4 ++--
 solr/webapp/web/js/angular/controllers/query.js | 6 +++---
 solr/webapp/web/partials/files.html             | 2 +-
 solr/webapp/web/partials/query.html             | 2 +-
 5 files changed, 11 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/bd459c12/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 3257602..bd81afa 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -74,9 +74,6 @@ Optimizations
   string fields from the FieldCache, resulting in up to 56% better throughput for those cases.
   (yonik)
 
-* SOLR-9584: Support Solr being proxied with another endpoint than default /solr, by using relative links
-  in AdminUI javascripts (Yun Jie Zhou via janhoy)
-
 * SOLR-5944: In-place updates of Numeric DocValues. To leverage this, the _version_ field and the updated
   field must both be stored=false, indexed=false, docValues=true. (Ishan Chattopadhyaya, hossman, noble,
   shalin, yonik)
@@ -175,6 +172,10 @@ Optimizations
 * SOLR-9764: All filters that which all documents in the index now share the same memory (DocSet).
   (Michael Sun, yonik)
 
+* SOLR-9584: Support Solr being proxied with another endpoint than default /solr, by using relative links
+  in AdminUI javascripts (Yun Jie Zhou via janhoy)
+
+
 Other Changes
 ----------------------
 * SOLR-9980: Expose configVersion in core admin status (Jessica Cheng Mallet via Tom�s Fern�ndez L�bbe)

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/bd459c12/solr/webapp/web/js/angular/controllers/files.js
----------------------------------------------------------------------
diff --git a/solr/webapp/web/js/angular/controllers/files.js b/solr/webapp/web/js/angular/controllers/files.js
index 00ea4b1..c1d7abf 100644
--- a/solr/webapp/web/js/angular/controllers/files.js
+++ b/solr/webapp/web/js/angular/controllers/files.js
@@ -25,7 +25,7 @@ solrAdminApp.controller('FilesController',
         $scope.file = $location.search().file;
         $scope.content = null;
 
-        $scope.baseurl = $location.protocol()+ "://" + $location.host() + ":" + $location.port();
+        $scope.baseurl = $location.absUrl().substr(0,$location.absUrl().indexOf("#")); // Including /solr/ context
 
         $scope.refresh = function () {
 
@@ -81,7 +81,7 @@ solrAdminApp.controller('FilesController',
 
                 Files.get({core: $routeParams.core, file: $scope.file, contentType: contentType}, function(data) {
                     $scope.content = data.data;
-                    $scope.url = $scope.baseurl + data.config.url + "?" + $.param(data.config.params);
+                    $scope.url = data.config.url + "?" + $.param(data.config.params);  // relative URL
                     if (contentType.indexOf("text/plain") && (data.data.indexOf("<?xml")>=0) || data.data.indexOf("<!--")>=0) {
                         $scope.lang = "xml";
                     } else {

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/bd459c12/solr/webapp/web/js/angular/controllers/query.js
----------------------------------------------------------------------
diff --git a/solr/webapp/web/js/angular/controllers/query.js b/solr/webapp/web/js/angular/controllers/query.js
index 1695647..5dd105b 100644
--- a/solr/webapp/web/js/angular/controllers/query.js
+++ b/solr/webapp/web/js/angular/controllers/query.js
@@ -88,9 +88,9 @@ solrAdminApp.controller('QueryController',
       Query.query(params, function(data) {
         $scope.lang = $scope.query.wt;
         $scope.response = data;
-        $scope.url = $location.protocol() + "://" +
-                     $location.host() + ":" +
-                     $location.port() + url;
+        // Use relative URL to make it also work through proxies that may have a different host/port/context
+        $scope.url = url;
+        $scope.hostPortContext = $location.absUrl().substr(0,$location.absUrl().indexOf("#")); // For display only
       });
     };
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/bd459c12/solr/webapp/web/partials/files.html
----------------------------------------------------------------------
diff --git a/solr/webapp/web/partials/files.html b/solr/webapp/web/partials/files.html
index 1278fbe..61914de 100644
--- a/solr/webapp/web/partials/files.html
+++ b/solr/webapp/web/partials/files.html
@@ -27,7 +27,7 @@ limitations under the License.
 
       <div class="top clearfix">
 
-        <a id="url" class="address-bar" href="{{url}}" ng-show="url">{{url}}</a>
+        <a id="url" class="address-bar" href="{{url}}" ng-show="url">{{baseurl}}{{url}}</a>
 
       </div>
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/bd459c12/solr/webapp/web/partials/query.html
----------------------------------------------------------------------
diff --git a/solr/webapp/web/partials/query.html b/solr/webapp/web/partials/query.html
index 31bc242..d68d236 100644
--- a/solr/webapp/web/partials/query.html
+++ b/solr/webapp/web/partials/query.html
@@ -345,7 +345,7 @@ limitations under the License.
 
   <div id="result">
 
-    <a ng-show="response.data" id="url" class="address-bar" ng-href="{{url}}">{{url}}</a>
+    <a ng-show="response.data" id="url" class="address-bar" ng-href="{{url}}">{{hostPortContext}}{{url}}</a>
 
     <div id="response">
       <pre class="syntax language-{{lang}}"><code ng-bind-html="response.data | highlight:lang | unsafe"></code></pre>