Переглянути джерело

HUE-5304 [assist] List collections via the new API

Romain Rigaux 8 роки тому
батько
коміт
5e0b573638

+ 3 - 2
desktop/core/src/desktop/static/desktop/js/apiHelper.js

@@ -62,7 +62,7 @@ var ApiHelper = (function () {
   var IMPALA_INVALIDATE_API = '/impala/api/invalidate';
   var CONFIG_SAVE_API = '/desktop/api/configurations/save/';
   var CONFIG_APPS_API = '/desktop/api/configurations';
-  var SOLR_COLLECTIONS_API = '/indexer/api/collections/';
+  var SOLR_COLLECTIONS_API = '/indexer/api/collections/list/';
   var HBASE_API_PREFIX = '/hbase/api/';
   var SAVE_TO_FILE = '/filebrowser/save';
 
@@ -541,7 +541,7 @@ var ApiHelper = (function () {
    */
   ApiHelper.prototype.fetchSolrCollections = function (options) {
     var self = this;
-    var url = SOLR_COLLECTIONS_API + '?format=json';
+    var url = SOLR_COLLECTIONS_API;
     var fetchFunction = function (storeInCache) {
       if (options.timeout === 0) {
         self.assistErrorCallback(options)({ status: -1 });
@@ -550,6 +550,7 @@ var ApiHelper = (function () {
       $.ajax({
         dataType: "json",
         url: url,
+        type: 'POST',
         timeout: options.timeout,
         success: function (data) {
           if (!data.error && !self.successResponseIsError(data) && typeof data.collections !== 'undefined' && data.collections !== null) {

+ 1 - 1
desktop/libs/libsolr/src/libsolr/rest_api.py → desktop/libs/indexer/src/indexer/solr_api.py

@@ -51,7 +51,7 @@ def api_error_handler(func):
 def list_collections(request):
   response = {'status': -1}
 
-  api = SolrApi()
+  api = SolrApi(user=request.user)
 
   response['collections'] = api.collections2()
   response['status'] = 0

+ 6 - 1
desktop/libs/indexer/src/indexer/urls.py

@@ -60,4 +60,9 @@ urlpatterns += patterns('indexer.api3',
   url(r'^api/indexer/guess_field_types/$', 'guess_field_types', name='guess_field_types'),
 
   url(r'^api/importer/submit', 'importer_submit', name='importer_submit')
-)
+)
+
+
+urlpatterns += patterns('indexer.solr_api',
+  url(r'^api/collections/list/$', 'list_collections', name='list_collections'),
+)

+ 0 - 23
desktop/libs/libsolr/src/libsolr/urls.py

@@ -1,23 +0,0 @@
-#!/usr/bin/env python
-# Licensed to Cloudera, Inc. under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  Cloudera, Inc. licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-from django.conf.urls import patterns, url
-
-
-urlpatterns = patterns('libsolr.rest_api',
-  url(r'^api/collections/list/$', 'list_collection', name='list_collection'),
-)