Browse Source

HUE-3228 [dashboard] Do not historify the dashboard queries

Improve UX of selecting SQL tables, it needs at least a DB and table name to
trigger the first query.
Romain Rigaux 8 years ago
parent
commit
acb9a2421b

+ 3 - 3
apps/impala/src/impala/dashboard_api.py

@@ -102,7 +102,7 @@ class SQLApi():
       sql = "SELECT %(fields)s FROM `%(database)s`.`%(table)s`" % {
           'database': database,
           'table': table,
-          'fields': ', '.join(['`%s`' % f for f in fields])
+          'fields': ', '.join(['`%s`' % f if f != '*' else '*' for f in fields])
       }
       if filters:
         sql += ' ' + self._convert_filters_to_where(filters)
@@ -114,8 +114,8 @@ class SQLApi():
         editor_type=dashboard['engine'],
         statement=sql,
         database=database,
-        status='ready-execute'
-        # historify=False
+        status='ready-execute',
+        skip_historify=True
     )
 
     response = editor.execute(MockRequest(self.user))

+ 1 - 1
apps/search/src/search/static/search/js/search.ko.js

@@ -1377,7 +1377,7 @@ var NewTemplate = function (vm, initial) {
     if (self.inited()) {
       // If new dashboard
       vm.collection.name.subscribe(function(newValue) {
-        if (newValue) {
+        if (newValue && (vm.collection.engine() == 'solr' || /^[^\.]+\.[^\.]+$/.test(newValue))) {
           vm.collection.label(newValue);
           vm.collection.switchCollection();
           vm.search();

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

@@ -103,7 +103,7 @@ def _execute_notebook(request, notebook, snippet):
   result = None
   history = None
 
-  historify = notebook['type'] != 'notebook' or snippet.get('wasBatchExecuted')
+  historify = (notebook['type'] != 'notebook' or snippet.get('wasBatchExecuted')) and not notebook.get('skipHistorify')
 
   try:
     try:

+ 1 - 0
desktop/libs/notebook/src/notebook/connectors/base.py

@@ -74,6 +74,7 @@ class Notebook(object):
           'isManaged': False,
           'sessions': [],
           'snippets': [],
+          'skipHistorify': False
       }
       _data.update(options)
       self.data = json.dumps(_data)

+ 2 - 1
desktop/libs/notebook/src/notebook/models.py

@@ -55,7 +55,7 @@ def escape_rows(rows, nulls_only=False):
 
 def make_notebook(name='Browse', description='', editor_type='hive', statement='', status='ready',
                   files=None, functions=None, settings=None, is_saved=False, database='default', snippet_properties=None, batch_submit=False,
-                  on_success_url=None):
+                  on_success_url=None, skip_historify=False):
   from notebook.connectors.hiveserver2 import HS2Api
 
   editor = Notebook()
@@ -97,6 +97,7 @@ def make_notebook(name='Browse', description='', editor_type='hive', statement='
     'showHistory': True,
     'isSaved': is_saved,
     'onSuccessUrl': on_success_url,
+    'skipHistorify': skip_historify,
     'snippets': [
       {
          'status': status,