janhoy commented on code in PR #4177:
URL: https://github.com/apache/solr/pull/4177#discussion_r4109502972
##########
solr/webapp/web/js/angular/controllers/documents.js:
##########
@@ -64,74 +74,57 @@ solrAdminApp.controller('DocumentsController',
};
$scope.submit = function () {
- var contentType = "";
- var postData = "";
- var params = {};
- var doingFileUpload = false;
-
- if ($scope.handler[0] == '/') {
- params.handler = $scope.handler.substring(1);
- } else {
- params.handler = 'update';
- params.qt = $scope.handler;
+ if ($scope.type == "upload") {
+ FileUpload.upload({
+ core: $routeParams.core,
+ handler: "update",
+ commitWithin: $scope.commitWithin,
+ overwrite: $scope.overwrite,
+ wt: "json",
+ raw: $scope.literalParams
+ }, $scope.fileUpload, function (data) {
+ $scope.responseStatus = "success";
+ $scope.response = JSON.stringify(data, null, ' ');
+ }, function (data) {
+ $scope.responseStatus = "failure";
+ $scope.response = JSON.stringify(data, null, ' ');
+ });
+ return;
}
- params.commitWithin = $scope.commitWithin;
- params.overwrite = $scope.overwrite;
- params.core = $routeParams.core;
- params.wt = "json";
-
+ var postData;
+ var updateMethod;
if ($scope.type == "json" || $scope.type == "wizard") {
postData = "[" + $scope.document + "]";
- contentType = "json";
- } else if ($scope.type == "csv") {
+ updateMethod = UpdateV2.update;
+ } else if ($scope.type == "solr-json") {
postData = $scope.document;
- contentType = "csv";
+ updateMethod = UpdateV2.update;
} else if ($scope.type == "xml") {
postData = "<add>" + $scope.document + "</add>";
- contentType = "xml";
- } else if ($scope.type == "upload") {
- doingFileUpload = true;
- params.raw = $scope.literalParams;
- } else if ($scope.type == "solr") {
+ updateMethod = UpdateV2.updateXml;
Review Comment:
Agree, `wt` should also die, it is a solr-custom substitute for `Accept`
header in a world where we tried to force every action into a browser address
bar GET style. People now have cURL and http clients so Accept should not be
difficult.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]