SOLR-8993: Admin UI support multiple DIH handlers

Updated Upayavira's patch to the master and fixed one missing parameter
This commit is contained in:
Alexandre Rafalovitch 2016-08-15 21:46:59 +10:00
parent 1af873f53e
commit 6dd228c117
4 changed files with 25 additions and 18 deletions

View File

@ -214,6 +214,8 @@ Bug Fixes
* SOLR-9002: Admin UI now correctly displays json and text files in the collection/Files screen (Upayavira, Alexandre Rafalovitch)
* SOLR-8993: Admin UI now correctly supports multiple DIH handler end-points (Upayavira, Alexandre Rafalovitch)
Optimizations
----------------------

View File

@ -17,7 +17,7 @@
// @todo test optimize (delete stuff, watch button appear, test button/form)
solrAdminApp.controller('CoreAdminController',
function($scope, $routeParams, $location, $timeout, Cores, Update, Constants){
function($scope, $routeParams, $location, $timeout, $route, Cores, Update, Constants){
$scope.resetMenu("cores", Constants.IS_ROOT_PAGE);
$scope.selectedCore = $routeParams.corename; // use 'corename' not 'core' to distinguish from /solr/:core/
$scope.refresh = function() {

View File

@ -39,20 +39,24 @@ solrAdminApp.controller('DataImportController',
}
});
DataImport.config({core: $routeParams.core}, function (data) {
try {
var xml = $.parseXML(data.config);
} catch (err) {
$scope.hasHandlers = false;
return;
}
$scope.config = data.config;
$scope.entities = [];
$('document > entity', xml).each(function (i, element) {
$scope.entities.push($(element).attr('name'));
$scope.handler = $routeParams.handler;
if ($scope.handler && $scope.handler[0]=="/") {
$scope.handler = $scope.handler.substr(1);
}
if ($scope.handler) {
DataImport.config({core: $routeParams.core, name: $scope.handler}, function (data) {
try {
$scope.config = data.config;
var xml = $.parseXML(data.config);
$scope.entities = [];
$('document > entity', xml).each(function (i, element) {
$scope.entities.push($(element).attr('name'));
});
} catch (err) {
console.log(err);
}
});
});
}
$scope.lastUpdate = "unknown";
$scope.lastUpdateUTC = "";
@ -81,7 +85,7 @@ solrAdminApp.controller('DataImportController',
}
$scope.reload = function () {
DataImport.reload({core: $routeParams.core}, function () {
DataImport.reload({core: $routeParams.core, name: $scope.handler}, function () {
$scope.reloaded = true;
$timeout(function () {
$scope.reloaded = false;
@ -126,6 +130,7 @@ solrAdminApp.controller('DataImportController',
}
params.core = $routeParams.core;
params.name = $scope.handler;
DataImport.post(params, function (data) {
$scope.rawResponse = JSON.stringify(data, null, 2);
@ -135,7 +140,7 @@ solrAdminApp.controller('DataImportController',
$scope.abort = function () {
$scope.isAborting = true;
DataImport.abort({core: $routeParams.core}, function () {
DataImport.abort({core: $routeParams.core, name: $scope.handler}, function () {
$timeout(function () {
$scope.isAborting = false;
$scope.refreshStatus();
@ -148,7 +153,7 @@ solrAdminApp.controller('DataImportController',
console.log("Refresh Status");
$scope.isStatusLoading = true;
DataImport.status({core: $routeParams.core}, function (data) {
DataImport.status({core: $routeParams.core, name: $scope.handler}, function (data) {
if (data[0] == "<") {
$scope.hasHandlers = false;
return;

View File

@ -162,7 +162,7 @@ solrAdminServices.factory('System',
}])
.factory('DataImport',
['$resource', function($resource) {
return $resource('/solr/:core/dataimport', {core: '@core', indent:'on', wt:'json', _:Date.now()}, {
return $resource('/solr/:core/:name', {core: '@core', name: '@name', indent:'on', wt:'json', _:Date.now()}, {
"config": {params: {command: "show-config"}, headers: {doNotIntercept: "true"},
transformResponse: function(data) {
return {config: data};