Prechádzať zdrojové kódy

HUE-7654 [core] Integrate Threads page as page on /about page

Roohi 8 rokov pred
rodič
commit
951dc7bbcf

+ 3 - 0
desktop/core/src/desktop/templates/about_layout.mako

@@ -46,6 +46,9 @@ def is_selected(section, matcher):
                 <li class="${is_selected(section, 'log_view')}">
                   <a href="${ url('desktop.views.log_view') }">${_('Server Logs')}</a>
                 </li>
+                  <li class="${is_selected(section, 'threads')}">
+                  <a href="${url('desktop.views.threads')}">${_('Threads')}</a>
+                </li>
               % endif
             </ul>
           </div>

+ 3 - 0
desktop/core/src/desktop/templates/hue.mako

@@ -359,6 +359,7 @@ ${ hueIcons.symbols() }
       <div id="embeddable_admin_wizard" class="embeddable"></div>
       <div id="embeddable_logs" class="embeddable"></div>
       <div id="embeddable_dump_config" class="embeddable"></div>
+      <div id="embeddable_threads" class="embeddable"></div>
       <div id="embeddable_403" class="embeddable"></div>
       <div id="embeddable_404" class="embeddable"></div>
       <div id="embeddable_500" class="embeddable"></div>
@@ -590,6 +591,7 @@ ${ smart_unicode(login_modal(request).content) | n,unicode }
         admin_wizard: { url: '/about/admin_wizard', title: '${_('Admin Wizard')}' },
         logs: { url: '/logs', title: '${_('Logs')}' },
         dump_config: { url: '/desktop/dump_config', title: '${_('Dump Configuration')}' },
+        threads: { url: '/desktop/debug/threads', title: '${_('Threads')}' },
         sqoop: { url: '/sqoop', title: '${_('Sqoop')}' },
         jobsub: { url: '/jobsub/not_available', title: '${_('Job Designer')}' },
         % if other_apps:
@@ -948,6 +950,7 @@ ${ smart_unicode(login_modal(request).content) | n,unicode }
           }},
           { url: '/dashboard/*', app: 'dashboard' },
           { url: '/desktop/dump_config', app: 'dump_config' },
+          { url: '/desktop/debug/threads', app: 'threads' },
           { url: '/desktop/download_logs', app: function () {
             location.href = '/desktop/download_logs';
           }},

+ 36 - 0
desktop/core/src/desktop/templates/threads.mako

@@ -0,0 +1,36 @@
+## 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.lib.i18n import smart_unicode
+from desktop.views import commonheader, commonfooter
+from django.utils.translation import ugettext as _
+import re
+%>
+
+<%namespace name="actionbar" file="actionbar.mako" />
+<%namespace name="layout" file="about_layout.mako" />
+%if not is_embeddable:
+${ commonheader(_('Threads'), "about", user, request) | n,unicode }
+%endif
+${layout.menubar(section='threads')}
+
+<div>
+    <pre> ${text}</pre>
+</div>
+
+%if not is_embeddable:
+${ commonfooter(request, messages) | n,unicode }
+%endif

+ 7 - 1
desktop/core/src/desktop/views.py

@@ -287,7 +287,13 @@ def threads(request):
   if not request.user.is_superuser:
     return HttpResponse(_("You must be a superuser."))
 
-  return HttpResponse(out.getvalue(), content_type="text/plain")
+  if request.is_ajax():
+    return HttpResponse(out.getvalue(), content_type="text/plain")
+  else:
+    return render("threads.mako", request, dict(text=out.getvalue(),
+                                                is_embeddable=request.GET.get('is_embeddable', False)
+                                              ))
+
 
 @access_log_level(logging.WARN)
 def memory(request):