Эх сурвалжийг харах

HUE-6874 [search] Make showing of core automatic and only if in non Solr Cloud

Romain Rigaux 8 жил өмнө
parent
commit
22844dd

+ 2 - 1
apps/search/src/search/dashboard_api.py

@@ -38,8 +38,9 @@ class SearchApi(DashboardApi):
     response = self.api.query(collection, query)
     return augment_solr_response(response, collection, query)
 
-  def datasets(self, show_all=False):
+  def datasets(self, show_all=False): # True if non Solr Cloud
     client = SolrClient(user=self.user)
+    show_all = show_all or not client.is_solr_cloud_mode()
     return [index['name'] for index in client.get_indexes(include_cores=show_all)]
 
   def fields(self, collection):

+ 1 - 0
desktop/libs/dashboard/src/dashboard/api.py

@@ -142,6 +142,7 @@ def nested_documents(request):
   except Exception, e:
     LOG.exception('Failed to list nested documents')
     result['message'] = force_unicode(e)
+    result['has_nested_documents'] = False
 
   return JsonResponse(result)
 

+ 1 - 6
desktop/libs/dashboard/src/dashboard/static/dashboard/js/search.ko.js

@@ -1407,7 +1407,7 @@ var NewTemplate = function (vm, initial) {
     vm.isSyncingCollections(true);
     $.post("/dashboard/get_collections", {
         collection: ko.mapping.toJSON(vm.collection),
-        show_all: ko.mapping.toJSON(vm.showCores)
+        show_all: false
       }, function (data) {
         if (data.status == 0) {
           // Sync new and old names
@@ -1572,10 +1572,6 @@ var SearchViewModel = function (collection_json, query_json, initial_json) {
       }
     });
 
-    self.showCores = ko.observable(false);
-    self.showCores.subscribe(function (newValue) {
-      self.initial.syncCollections();
-    });
     self.isSyncingCollections = ko.observable(false);
 
     self.isPlayerMode = ko.observable(false);
@@ -2400,7 +2396,6 @@ var SearchViewModel = function (collection_json, query_json, initial_json) {
     self.isRetrievingResults(false);
     self.hasRetrievedResults(true);
     self.asyncSearchesCounter([]);
-    self.showCores(false);
     self.isSyncingCollections(false);
     self.isPlayerMode(false);
 

+ 0 - 1
desktop/libs/dashboard/src/dashboard/templates/common_search.mako

@@ -114,7 +114,6 @@ from desktop.views import commonheader, commonfooter, _ko
       <select data-bind="options: $root.initial.collections, value: $root.collection.name, disable: isSyncingCollections"></select>
 
         <label class="checkbox" style="display:inline-block; margin-left: 10px">
-          <input type="checkbox" data-bind="checked: showCores" />${ _('Show cores') }
           <i class="fa fa-spinner fa-spin" data-bind="visible: isSyncingCollections"></i>
         </label>
       <!-- /ko -->