瀏覽代碼

HUE-3281 [editor] Simplified mobile version skeleton

Romain Rigaux 9 年之前
父節點
當前提交
ee9b040

+ 47 - 0
desktop/libs/notebook/src/notebook/templates/editorm.mako

@@ -0,0 +1,47 @@
+## Licensed to Cloudera, Inc. under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  Cloudera, Inc. licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+<%!
+  from desktop.views import commonheader, commonfooter
+  from desktop import conf
+  from django.utils.translation import ugettext as _
+%>
+
+<%namespace name="assist" file="/assist.mako" />
+<%namespace name="configKoComponents" file="/config_ko_components.mako" />
+<%namespace name="editorComponents" file="editor_components.mako" />
+<%namespace name="notebookKoComponents" file="notebook_ko_components.mako" />
+
+${ commonheader(_('Editor'), editor_type, user, "68px") | n,unicode }
+
+${ editorComponents.includes() }
+
+<style type="text/css">
+  .snippet {
+    margin-right: 10px;
+  }
+</style>
+
+${ editorComponents.topBar() }
+${ editorComponents.commonHTML() }
+
+${ assist.assistPanel() }
+${ configKoComponents.config() }
+${ notebookKoComponents.downloadSnippetResults() }
+${ notebookKoComponents.snippetDbSelection() }
+
+${ editorComponents.commonJS() }
+
+${ commonfooter(request, messages) | n,unicode }

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

@@ -41,6 +41,7 @@ urlpatterns = patterns('notebook.views',
   url(r'^copy/?$', 'copy', name='copy'),
 
   url(r'^editor/?$', 'editor', name='editor'),
+  url(r'^editorm/?$', 'editor', name='editorm'),
   url(r'^browse/(?P<database>\w+)/(?P<table>\w+)/?$', 'browse', name='browse'),
   url(r'^execute_and_watch/?$', 'execute_and_watch', name='execute_and_watch'),
 )

+ 22 - 0
desktop/libs/notebook/src/notebook/views.py

@@ -109,6 +109,28 @@ def editor(request):
   })
 
 
+@check_document_access_permission()
+def editorm(request):
+  editor_id = request.GET.get('editor')
+  editor_type = request.GET.get('type', 'hive')
+
+  if editor_id:  # Open existing saved editor document
+    document = Document2.objects.get(id=editor_id)
+    editor_type = document.type.rsplit('-', 1)[-1]
+
+  return render('editorm.mako', request, {
+      'editor_id': editor_id or None,
+      'notebooks_json': '{}',
+      'options_json': json.dumps({
+          'languages': get_interpreters(request.user),
+          'mode': 'editor',
+          'is_optimizer_enabled': has_optimizer(),
+          'is_navigator_enabled': has_navigator(request.user),
+          'editor_type': editor_type
+      })
+  })
+
+
 def new(request):
   return notebook(request)