Преглед на файлове

[libsolr] Add API to list Solr Cloud configs

Romain Rigaux преди 9 години
родител
ревизия
de52c19
променени са 2 файла, в които са добавени 13 реда и са изтрити 1 реда
  1. 1 1
      apps/security/src/security/api/sentry.py
  2. 12 0
      desktop/libs/libsolr/src/libsolr/api.py

+ 1 - 1
apps/security/src/security/api/sentry.py

@@ -85,7 +85,7 @@ def _fetch_collections(request):
   elif item == 'collections':
     return {"tables_meta": [{"comment": None, "type": "Table", "name": col} for col in api.collections2()]}
   elif item == 'configs':
-    return {"tables_meta": [{"comment": None, "type": "Table", "name": "log_analytics_demo"}, {"comment": None, "type": "Table", "name": "schemalessTemplateSecure"}]}
+    return {"tables_meta": [{"comment": None, "type": "Table", "name": conf} for conf in api.configs()]}
   else:
     raise PopupException(_('Authorizable %s could not be retrieved') % path)
 

+ 12 - 0
desktop/libs/libsolr/src/libsolr/api.py

@@ -471,6 +471,18 @@ class SolrApi(object):
     except RestException, e:
       raise PopupException(e, title=_('Error while accessing Solr'))
 
+
+  def configs(self):
+    try:
+      params = self._get_params() + (
+          ('action', 'LIST'),
+          ('wt', 'json'),
+      )
+      return self._root.get('admin/configs', params=params)['configSets']
+    except RestException, e:
+      raise PopupException(e, title=_('Error while accessing Solr'))
+
+
   def aliases(self):
     try:
       params = self._get_params() + ( # Waiting for SOLR-4968