This is an automated email from the ASF dual-hosted git repository.
thelabdude pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/main by this push:
new 99713cb SOLR-15620: Download Config button in Schema Designer screen
should not require user to re-login when already authenticated (#291)
99713cb is described below
commit 99713cb31f654f477c61daf2e9bef5b94e5e8378
Author: Timothy Potter <[email protected]>
AuthorDate: Thu Sep 9 14:02:11 2021 -0600
SOLR-15620: Download Config button in Schema Designer screen should not
require user to re-login when already authenticated (#291)
---
solr/CHANGES.txt | 2 ++
.../web/js/angular/controllers/schema-designer.js | 24 +++++++++++++++++++++-
2 files changed, 25 insertions(+), 1 deletion(-)
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 1d57d02..604e1e7 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -452,6 +452,8 @@ Bug Fixes
* SOLR-15595: Partial results from shard queries needlessly discarded for
queries without sort field (Michael Kosten via Mike Drob, Eric Pugh)
+* SOLR-15620: Download Config button in Schema Designer screen should not
require user to re-login when already authenticated (Timothy Potter)
+
Other Changes
---------------------
* SOLR-15566: Clarify ref guide documentation about SQL queries with `SELECT
*` requiring a `LIMIT` clause (Timothy Potter)
diff --git a/solr/webapp/web/js/angular/controllers/schema-designer.js
b/solr/webapp/web/js/angular/controllers/schema-designer.js
index 7b0204b..17a41b9 100644
--- a/solr/webapp/web/js/angular/controllers/schema-designer.js
+++ b/solr/webapp/web/js/angular/controllers/schema-designer.js
@@ -1513,7 +1513,29 @@ solrAdminApp.controller('SchemaDesignerController',
function ($scope, $timeout,
};
$scope.downloadConfig = function () {
- location.href =
"/api/schema-designer/download/"+$scope.currentSchema+"_configset.zip?wt=raw&configSet="
+ $scope.currentSchema;
+ // have to use an AJAX request so we can supply the Authorization header
+ if (sessionStorage.getItem("auth.header")) {
+ var fileName = $scope.currentSchema+"_configset.zip";
+ var xhr = new XMLHttpRequest();
+ xhr.open("GET",
"/api/schema-designer/download/"+fileName+"?wt=raw&configSet="+$scope.currentSchema,
true);
+ xhr.setRequestHeader('Authorization',
sessionStorage.getItem("auth.header"));
+ xhr.responseType = 'blob';
+ xhr.addEventListener('load',function() {
+ if (xhr.status === 200) {
+ var url = window.URL.createObjectURL(xhr.response);
+ var a = document.createElement('a');
+ a.href = url;
+ a.download = fileName;
+ document.body.append(a);
+ a.click();
+ a.remove();
+ window.URL.revokeObjectURL(url);
+ }
+ })
+ xhr.send();
+ } else {
+ location.href =
"/api/schema-designer/download/"+$scope.currentSchema+"_configset.zip?wt=raw&configSet="
+ $scope.currentSchema;
+ }
};
function docsToTree(docs) {