Преглед изворни кода

HUE-6471 [frontend] Rount the /jobsub urls on Hue 4 to Hue 3

Enrico Berti пре 8 година
родитељ
комит
28aaf4b

+ 44 - 0
apps/jobsub/src/jobsub/templates/not_available.mako

@@ -0,0 +1,44 @@
+## 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 django.utils.translation import ugettext as _
+%>
+
+<link rel="stylesheet" href="${ static('desktop/css/httperrors.css') }">
+
+<div id="httperror" class="container-fluid">
+  <div class="row-fluid">
+    <div class="span12 center">
+      <div class="error-code"><i class="fa fa-exclamation"></i></div>
+    </div>
+  </div>
+  <div class="row-fluid">
+    <div class="span6 offset3 center error-box">
+      <h1>${_('Job Designer is not available on Hue 4')}</h1>
+
+      <p>${_("We're sorry, but the requested page is deprecated and could not be shown.")}</p>
+      <br/>
+      <a id="openInHue3" href="javascript:void(0)" target="_blank">${_('Open it in Hue 3 instead')}</a>
+    </div>
+  </div>
+</div>
+
+<script>
+  $(document).ready(function(){
+    $('#openInHue3').attr('href', window.location.pathname.substr(4) + window.location.hash);
+  });
+</script>

+ 3 - 0
apps/jobsub/src/jobsub/urls.py

@@ -23,6 +23,9 @@ urlpatterns = patterns(
   # The base view is the "list" view, which we alias as /
   url(r'^$', 'list_designs'),
 
+  # Not available on Hue 4
+  url(r'^not_available$', 'not_available'),
+
   # Actions: get, save, clone, delete, submit, new.
   url(r'^designs$', 'list_designs'),
   url(r'^designs/(?P<design_id>\d+)$', 'get_design'),

+ 2 - 0
apps/jobsub/src/jobsub/views.py

@@ -110,6 +110,8 @@ def list_designs(request):
       'is_hue_4': IS_HUE_4.get()
     })
 
+def not_available(request):
+  return render("not_available.mako", request, {})
 
 def _get_design(user, design_id):
   """Raise PopupException if design doesn't exist"""

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

@@ -386,6 +386,7 @@ ${ hueIcons.symbols() }
       <div id="embeddable_404" class="embeddable"></div>
       <div id="embeddable_500" class="embeddable"></div>
       <div id="embeddable_sqoop" class="embeddable"></div>
+      <div id="embeddable_jobsub" class="embeddable"></div>
     </div>
 
     <div id="rightResizer" class="resizer" data-bind="visible: rightAssistVisible() && rightAssistAvailable(), splitFlexDraggable : {
@@ -582,6 +583,7 @@ ${ smart_unicode(login_modal(request).content) | n,unicode }
         logs: { url: '/logs', title: '${_('Logs')}' },
         dump_config: { url: '/desktop/dump_config', title: '${_('Dump Configuration')}' },
         sqoop: { url: '/sqoop', title: '${_('Sqoop')}' },
+        jobsub: { url: '/jobsub/not_available', title: '${_('Job Designer')}' },
       };
 
       var SKIP_CACHE = [
@@ -973,6 +975,7 @@ ${ smart_unicode(login_modal(request).content) | n,unicode }
             page('/security/hive');
           }},
           { url: '/sqoop', app: 'sqoop' },
+          { url: '/jobsub', app: 'jobsub' },
           { url: '/useradmin/configurations/', app: 'useradmin_configurations' },
           { url: '/useradmin/groups/', app: 'useradmin_groups' },
           { url: '/useradmin/groups/new', app: 'useradmin_newgroup' },