ソースを参照

[editor] Add links to the new editors

Romain Rigaux 10 年 前
コミット
5d9ec3b582

+ 2 - 1
desktop/core/src/desktop/templates/common_header.mako

@@ -412,10 +412,11 @@ from django.utils.translation import ugettext as _
          <ul role="menu" class="dropdown-menu">
            % if 'beeswax' in apps:
              <li><a href="/${apps['beeswax'].display_name}"><img src="${ static(apps['beeswax'].icon_path) }" class="app-icon"/> ${_('Hive')}</a></li>
-             <li><a href="${ url('notebook:editor_hive') }"><img src="${ static(apps['beeswax'].icon_path) }" class="app-icon"/> ${_('New Hive')}</a></li>
+             <li><a href="${ url('notebook:editor') }?type=hive"><img src="${ static(apps['beeswax'].icon_path) }" class="app-icon"/> ${_('New Hive')}</a></li>
            % endif
            % if 'impala' in apps:
              <li><a href="/${apps['impala'].display_name}"><img src="${ static(apps['impala'].icon_path) }" class="app-icon"/> ${_('Impala')}</a></li>
+             <li><a href="${ url('notebook:editor') }?type=impala"><img src="${ static(apps['impala'].icon_path) }" class="app-icon"/> ${_('New Impala')}</a></li>
            % endif
            % if 'rdbms' in apps:
             <li><a href="/${apps['rdbms'].display_name}"><img src="${ static(apps['rdbms'].icon_path) }" class="app-icon"/> ${_('DB Query')}</a></li>

+ 0 - 1
desktop/libs/notebook/src/notebook/urls.py

@@ -41,7 +41,6 @@ urlpatterns = patterns('notebook.views',
   url(r'^copy$', 'copy', name='copy'),
 
   url(r'^editor$', 'editor', name='editor'),
-  url(r'^editor/hive$', 'editor_hive', name='editor_hive'),
 )
 
 # APIs

+ 3 - 6
desktop/libs/notebook/src/notebook/views.py

@@ -71,13 +71,14 @@ def notebook(request):
 @check_document_access_permission()
 def editor(request):
   editor_id = request.GET.get('editor')
+  editor_type = request.GET.get('type', 'hive')
 
   if editor_id:
     editor = Notebook(document=Document2.objects.get(id=editor_id))
   else:
     editor = Notebook()
     data = editor.get_data()
-    data['name'] = 'Hive Query'
+    data['name'] = '%s Query' % editor_type.title()
     data['type'] = 'query'    
     editor.data = json.dumps(data)
 
@@ -90,16 +91,12 @@ def editor(request):
   return render('editor.mako', request, {
       'notebooks_json': json.dumps([editor.get_data()]),
       'options_json': json.dumps({
-          'languages': [{"name": "Hive SQL", "type": "hive"}]
+          'languages': [{"name": "%s SQL" % editor_type.title(), "type": editor_type}]
       }),
       'autocomplete_base_url': autocomplete_base_url,
   })
 
 
-def editor_hive(request):
-  return editor(request)
-
-
 def new(request):
   return notebook(request)