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

HUE-6060 [editor] Enable clearing the task history

Romain Rigaux 8 жил өмнө
parent
commit
923cdbbc5e

+ 5 - 3
desktop/core/src/desktop/templates/responsive.mako

@@ -246,7 +246,9 @@ ${ hueIcons.symbols() }
               <!-- ko if: history().length > 0 -->
               <div class="notification-history-title">
                 <strong>${ _('History') }</strong>
-                <div class="inactive-action pointer pull-right" title="${_('Clear the query history')}" data-target="#clearNotificationHistoryModal" data-toggle="modal" rel="tooltip"><i class="fa fa-calendar-times-o"></i></div>
+                <div class="inactive-action pointer pull-right" title="${_('Clear the query history')}" data-target="#clearNotificationHistoryModal" data-toggle="modal" rel="tooltip">
+                  <i class="fa fa-calendar-times-o"></i>
+                </div>
                 <div class="clearfix"></div>
               </div>
               <ul class="unstyled notification-history-list">
@@ -438,10 +440,10 @@ ${ hueIcons.symbols() }
 <div id="clearNotificationHistoryModal" class="modal hide fade">
   <div class="modal-header">
     <a href="#" class="close" data-dismiss="modal">&times;</a>
-    <h3>${_('Confirm History Clear')}</h3>
+    <h3>${_('Confirm History Clearing')}</h3>
   </div>
   <div class="modal-body">
-    <p>${_('Are you sure you want to clear the query history?')}</p>
+    <p>${_('Are you sure you want to clear the task history?')}</p>
   </div>
   <div class="modal-footer">
     <a class="btn" data-dismiss="modal">${_('No')}</a>

+ 5 - 1
desktop/libs/notebook/src/notebook/api.py

@@ -466,8 +466,12 @@ def clear_history(request):
 
   notebook = json.loads(request.POST.get('notebook'), '{}')
   doc_type = request.POST.get('doc_type')
+  is_notification_manager = request.POST.get('is_notification_manager', 'false') == 'true'
 
-  history = Document2.objects.get_history(doc_type='query-%s' % doc_type, user=request.user)
+  if is_notification_manager:
+    history = Document2.objects.get_tasks_history(user=request.user)
+  else:
+    history = Document2.objects.get_history(doc_type='query-%s' % doc_type, user=request.user)
 
   response['updated'] = history.delete()
   response['message'] = _('History cleared !')

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

@@ -2161,7 +2161,8 @@ var EditorViewModel = (function() {
       logGA('clearHistory');
       $.post("/notebook/api/clear_history", {
         notebook: ko.mapping.toJSON(self.getContext()),
-        doc_type: self.selectedSnippet()
+        doc_type: self.selectedSnippet(),
+        is_notification_manager: vm.isNotificationManager(),
       }, function (data) {
         self.history.removeAll();
         if (self.isHistory()) {