SOLR-8993: Admin UI support multiple DIH handlers

This commit is contained in:
Alexandre Rafalovitch 2016-08-15 22:37:53 +10:00
parent 7df2a9e266
commit d7ba1e1eff
4 changed files with 26 additions and 20 deletions

View File

@ -179,6 +179,8 @@ Bug Fixes
* SOLR-9002: Admin UI now correctly displays json and text files in the collection/Files screen (Upayavira, Alexandre Rafalovitch) * 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 Optimizations
---------------------- ----------------------

View File

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

View File

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

View File

@ -162,7 +162,7 @@ solrAdminServices.factory('System',
}]) }])
.factory('DataImport', .factory('DataImport',
['$resource', function($resource) { ['$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"}, "config": {params: {command: "show-config"}, headers: {doNotIntercept: "true"},
transformResponse: function(data) { transformResponse: function(data) {
return {config: data}; return {config: data};