Bladeren bron

HUE-3593 [editor] Link to the list of notebooks is wrong

Romain Rigaux 9 jaren geleden
bovenliggende
commit
d904ab3

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

@@ -59,6 +59,7 @@ class Notebook(object):
       self.data = json.dumps({
           'name': 'My Notebook',
           'description': '',
+          'type': 'notebook',
           'snippets': [],
       })
 

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

@@ -154,7 +154,7 @@ ${ require.config() }
 
 </%def>
 
-<%def name="topBar(mode='notebook', editor_type='hive')">
+<%def name="topBar(mode='notebook', editor_type='notebook')">
 <style type="text/css">
 % if conf.CUSTOM.BANNER_TOP_HTML.get():
   .search-bar {

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

@@ -27,7 +27,7 @@
 ${ commonheader(_('Notebook'), app_name, user, "68px") | n,unicode }
 
 ${ editorComponents.includes() }
-${ editorComponents.topBar('notebook') }
+${ editorComponents.topBar(editor_type) }
 <%editorComponents:commonHTML>
   <%def name="addSnippetHTML()">
     <h1 class="empty" data-bind="visible: $root.availableSnippets().length == 0">${ _('There are no snippets configured.') }</h1>

+ 4 - 4
desktop/libs/notebook/src/notebook/views.py

@@ -40,12 +40,12 @@ LOG = logging.getLogger(__name__)
 
 
 def notebooks(request):
-  editor_type = request.GET.get('type')
+  editor_type = request.GET.get('type', 'notebook')
 
-  if editor_type:
-    notebooks = [d.content_object.to_dict() for d in Document.objects.get_docs(request.user, Document2, qfilter=Q(extra='notebook') | Q(extra__startswith='query')) if not d.content_object.is_history and d.content_object.type == 'query-' + editor_type]
+  if editor_type != 'notebook':
+    notebooks = [d.content_object.to_dict() for d in Document.objects.get_docs(request.user, Document2, qfilter=Q(extra__startswith='query')) if not d.content_object.is_history and d.content_object.type == 'query-' + editor_type]
   else:
-    notebooks = [d.content_object.to_dict() for d in Document.objects.get_docs(request.user, Document2, qfilter=Q(extra='notebook') | Q(extra__startswith='query')) if not d.content_object.is_history]
+    notebooks = [d.content_object.to_dict() for d in Document.objects.get_docs(request.user, Document2, qfilter=Q(extra='notebook')) if not d.content_object.is_history]
 
   return render('notebooks.mako', request, {
       'notebooks_json': json.dumps(notebooks, cls=JSONEncoderForHTML),