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

HUE-5443 [metadata] Upload history according to the editor type

Romain Rigaux 9 жил өмнө
parent
commit
b05fd80f38

+ 1 - 1
apps/useradmin/src/useradmin/templates/edit_permissions.mako

@@ -68,7 +68,7 @@ ${layout.menubar(section='permissions')}
       searchPlaceholder: "${_('Search')}",
       noChoicesFound: "${_('No groups found.')}",
       width: 600,
-      height: 240
+      height: 500
     });
   });
 </script>

+ 3 - 3
desktop/libs/metadata/src/metadata/optimizer_api.py

@@ -283,9 +283,9 @@ def upload_history(request):
   response = {'status': -1}
 
   n = request.POST.get('n')
-  query_type = 'hive'
+  source_platform = request.POST.get('sourcePlatform', 'hive')
 
-  history = Document2.objects.get_history(doc_type='query-%s' % query_type, user=request.user)
+  history = Document2.objects.get_history(doc_type='query-%s' % source_platform, user=request.user)
   if n:
     history = history[:n]
 
@@ -303,7 +303,7 @@ def upload_history(request):
 
   api = OptimizerApi()
 
-  response['upload_history'] = api.upload(queries=queries, source_platform=query_type)
+  response['upload_history'] = api.upload(queries=queries, source_platform=source_platform)
   response['status'] = 0
 
   return JsonResponse(response)

+ 1 - 1
desktop/libs/metadata/src/metadata/optimizer_client.py

@@ -57,7 +57,7 @@ class OptimizerApi(object):
     self._email_password = OPTIMIZER.EMAIL_PASSWORD.get()
     self._product_secret = product_secret if product_secret else OPTIMIZER.PRODUCT_SECRET.get()
     self._product_auth_secret = product_auth_secret if product_auth_secret else OPTIMIZER.PRODUCT_AUTH_SECRET.get()
-    self._product_name = product_name if product_name else (OPTIMIZER.PRODUCT_NAME.get() or self.get_tenant()['tenant']) # Aka "tenant"
+    self._product_name = product_name if product_name else (OPTIMIZER.PRODUCT_NAME.get() or self.get_tenant()['tenant']) # Aka "workload"
 
     self._client = HttpClient(self._api_url, logger=LOG)
     self._client.set_verify(ssl_cert_ca_verify)

+ 3 - 2
desktop/libs/notebook/src/notebook/static/notebook/js/notebook.ko.js

@@ -1396,7 +1396,8 @@ var EditorViewModel = (function() {
       logGA('load_query_history');
 
       $.post("/metadata/api/optimizer/upload_history", {
-        n: n
+        n: typeof n != "undefined" ? n : null,
+        sourcePlatform: self.type()
       }, function(data) {
         if (data.status == 0) {
           $(document).trigger("info", "Queries uploaded successfully. Preparing them...");
@@ -1409,7 +1410,7 @@ var EditorViewModel = (function() {
 
     self.watchUploadStatus = function (workloadId) {
       $.post("/metadata/api/optimizer/upload_status", {
-        workloadId: workloadId,
+        workloadId: workloadId
       }, function(data) {
         if (data.status == 0) {
           $(document).trigger("info", "Query processing: " + data.upload_status.status.state);

+ 1 - 1
desktop/libs/notebook/src/notebook/templates/editor_components.mako

@@ -2221,7 +2221,7 @@ ${ hueIcons.symbols() }
           </a>
         </li>
         <li>
-          <a href="javascript:void(0)" data-bind="click: loadQueryHistory" title="${ _('Load past query history in order to improve recommendations') }">
+          <a href="javascript:void(0)" data-bind="click: function() { loadQueryHistory(null); }" title="${ _('Load past query history in order to improve recommendations') }">
             <i class="fa fa-fw fa-cloud-upload"></i> ${_('Upload history')}
           </a>
         </li>