示例#1
0
文件: views.py 项目: javachengwc/hue
def editor(request):
  notebook_id = request.GET.get('notebook')

  if notebook_id:
    notebook = Notebook(document=Document2.objects.get(id=notebook_id))
  else:
    notebook = Notebook()

  autocomplete_base_url = ''
  try:
    autocomplete_base_url = reverse('beeswax:api_autocomplete_databases', kwargs={})
  except:
    LOG.exception('failed to get autocomplete base url')

  return render('editor.mako', request, {
      'notebooks_json': json.dumps([notebook.get_data()]),
      'options_json': json.dumps({
          'languages': LANGUAGES.get(),
          'snippet_placeholders' : {
              'scala': _('Example: 1 + 1, or press CTRL + space'),
              'python': _('Example: 1 + 1, or press CTRL + space'),
              'impala': _('Example: SELECT * FROM tablename, or press CTRL + space'),
              'hive': _('Example: SELECT * FROM tablename, or press CTRL + space'),
              'text': _('<h2>This is a text snippet</h2>Type your text here')
          }
      }),
      'autocomplete_base_url': autocomplete_base_url,
  })
示例#2
0
文件: views.py 项目: hwl-py/hue
def notebook(request):
  notebook_id = request.GET.get('notebook')

  if notebook_id:
    notebook = Notebook(document=Document2.objects.get(id=notebook_id))
  else:
    notebook = Notebook()

  autocomplete_base_url = ''
  try:
    autocomplete_base_url = reverse('beeswax:api_autocomplete_databases', kwargs={})
  except:
    LOG.exception('failed to get autocomplete base url')

  return render('notebook.mako', request, {
      'notebooks_json': json.dumps([notebook.get_data()]),
      'options_json': json.dumps({
          'languages': LANGUAGES.get(),
          'snippet_placeholders' : {
              'scala': _('/** Example: 1 + 1, or press CTRL + space */'),
              'python': _('# Example: 1 + 1, or press CTRL + space'),
              'impala': _('-- Example: SELECT * FROM tablename, or press CTRL + space'),
              'hive': _('-- Example: SELECT * FROM tablename, or press CTRL + space'),
              'text': _('<h2>This is a text snippet</h2>Type your text here')
          },
          'session_properties': SparkApi.PROPERTIES
      }),
      'autocomplete_base_url': autocomplete_base_url,
      'is_yarn_mode': LIVY_SERVER_SESSION_KIND.get()
  })
示例#3
0
def notebook(request):
    notebook_id = request.GET.get('notebook')

    if notebook_id:
        notebook = Notebook(document=Document2.objects.get(id=notebook_id))
    else:
        notebook = Notebook()

    autocomplete_base_url = ''
    try:
        autocomplete_base_url = reverse('beeswax:api_autocomplete_databases',
                                        kwargs={})
    except:
        LOG.exception('failed to get autocomplete base url')

    return render(
        'notebook.mako', request, {
            'notebooks_json':
            json.dumps([notebook.get_data()]),
            'options_json':
            json.dumps({
                'languages': LANGUAGES.get(),
                'snippet_placeholders': {
                    'scala':
                    _('/** Example: 1 + 1, or press CTRL + space */'),
                    'python':
                    _('# Example: 1 + 1, or press CTRL + space'),
                    'impala':
                    _('-- Example: SELECT * FROM tablename, or press CTRL + space'
                      ),
                    'hive':
                    _('-- Example: SELECT * FROM tablename, or press CTRL + space'
                      ),
                    'text':
                    _('<h2>This is a text snippet</h2>Type your text here'),
                    'r':
                    _('# Example: 1 + 1, or press CTRL + space')
                },
                'session_properties': SparkApi.PROPERTIES
            }),
            'autocomplete_base_url':
            autocomplete_base_url,
            'is_yarn_mode':
            LIVY_SERVER_SESSION_KIND.get()
        })
示例#4
0
def editor(request):
    notebook_id = request.GET.get('notebook')

    if notebook_id:
        notebook = Notebook(
            document=Document2.objects.get(id=notebook_id))  # Todo perms
    else:
        notebook = Notebook()

    autocomplete_base_url = ''
    try:
        autocomplete_base_url = reverse('beeswax:api_autocomplete_databases',
                                        kwargs={})
    except:
        pass

    return render(
        'editor.mako', request, {
            'notebooks_json':
            json.dumps([notebook.get_data()]),
            'options_json':
            json.dumps({
                'languages': LANGUAGES.get(),
                'snippet_placeholders': {
                    'scala':
                    _('Example: 1 + 1, or press CTRL + space'),
                    'python':
                    _('Example: 1 + 1, or press CTRL + space'),
                    'impala':
                    _('Example: SELECT * FROM tablename, or press CTRL + space'
                      ),
                    'hive':
                    _('Example: SELECT * FROM tablename, or press CTRL + space'
                      ),
                    'text':
                    _('<h2>This is a text snippet</h2>Type your text here')
                }
            }),
            'autocomplete_base_url':
            autocomplete_base_url,
        })
示例#5
0
def editor(request):
  notebook_id = request.GET.get('notebook')
  
  if notebook_id:
    notebook = Notebook(document=Document2.objects.get(id=notebook_id)) # Todo perms
  else:
    notebook = Notebook()
    
  return render('editor.mako', request, {
      'notebooks_json': json.dumps([notebook.get_data()]),
      'options_json': json.dumps({
          'languages': LANGUAGES.get(),
          'snippet_placeholders' : {
              'scala': _('Example: 1 + 1, or press CTRL + space'),
              'python': _('Example: 1 + 1, or press CTRL + space'),
              'impala': _('Example: SELECT * FROM tablename, or press CTRL + space'),
              'hive': _('Example: SELECT * FROM tablename, or press CTRL + space'),
              'text': _('<h2>This is a text snippet</h2>Type your text here')
          }
      })
  })