浏览代码

HUE-6091 [core] Changed home to follow the is_embeddable format

Enrico Berti 8 年之前
父节点
当前提交
f9a0413cbe

+ 50 - 6
desktop/core/src/desktop/templates/home2.mako

@@ -22,13 +22,36 @@
 <%namespace name="assist" file="/assist.mako" />
 <%namespace name="assist" file="/assist.mako" />
 <%namespace name="common_home" file="/common_home.mako" />
 <%namespace name="common_home" file="/common_home.mako" />
 
 
+%if not is_embeddable:
 ${ commonheader(_('Welcome Home'), "home", user, request) | n,unicode }
 ${ commonheader(_('Welcome Home'), "home", user, request) | n,unicode }
-
 ${ assist.assistJSModels() }
 ${ assist.assistJSModels() }
+${ assist.assistPanel() }
+%endif
 
 
-${ common_home.homeJSModels() }
+${ common_home.homeJSModels(is_embeddable) }
 
 
-${ assist.assistPanel() }
+%if is_embeddable:
+
+<style type="text/css">
+
+  .step-icon {
+    color: #DDDDDD;
+    font-size: 116px;
+    margin: 10px;
+    margin-right: 20px;
+    width: 130px;
+  }
+
+  .nav-tabs > li.active {
+    padding: 0;
+  }
+
+  svg.hi {
+    width: 24px;
+  }
+</style>
+
+%else:
 
 
 <style type="text/css">
 <style type="text/css">
   html {
   html {
@@ -160,8 +183,26 @@ ${ assist.assistPanel() }
   }
   }
 </style>
 </style>
 
 
-
 ${ common_home.navbar() }
 ${ common_home.navbar() }
+%endif
+
+%if is_embeddable:
+  <div id="homeComponents" class="main-content">
+  <div class="vertical-full container-fluid" data-bind="style: { 'padding-left' : $root.isLeftPanelVisible() ? '0' : '20px' }">
+    <div class="vertical-full row-fluid panel-container">
+      <div class="content-panel home-container" data-bind="style: { 'padding-left' : $root.isLeftPanelVisible() ? '8px' : '0' }">
+        <div class="doc-browser" data-bind="component: {
+          name: 'doc-browser',
+          params: {
+            activeEntry: activeEntry
+          }
+        }"></div>
+      </div>
+    </div>
+  </div>
+</div>
+
+%else :
 
 
 <div id="homeComponents" class="main-content">
 <div id="homeComponents" class="main-content">
 ##   Uncomment to enable the assist panel
 ##   Uncomment to enable the assist panel
@@ -202,8 +243,11 @@ ${ common_home.navbar() }
   </div>
   </div>
 </div>
 </div>
 
 
-${ common_home.vm() }
-${ common_home.tour() }
+%endif
 
 
+${ common_home.vm(is_embeddable) }
+${ common_home.tour() }
 
 
+%if not is_embeddable:
 ${ commonfooter(request, messages) | n,unicode }
 ${ commonfooter(request, messages) | n,unicode }
+%endif

+ 0 - 62
desktop/core/src/desktop/templates/home_embeddable.mako

@@ -1,62 +0,0 @@
-## 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, _ko
-  from desktop import conf
-  from django.utils.translation import ugettext as _
-%>
-
-<%namespace name="common_home" file="/common_home.mako" />
-
-${ common_home.homeJSModels(True) }
-
-<style type="text/css">
-
-  .step-icon {
-    color: #DDDDDD;
-    font-size: 116px;
-    margin: 10px;
-    margin-right: 20px;
-    width: 130px;
-  }
-
-  .nav-tabs > li.active {
-    padding: 0;
-  }
-
-  svg.hi {
-    width: 24px;
-  }
-</style>
-
-
-<div id="homeComponents" class="main-content">
-  <div class="vertical-full container-fluid" data-bind="style: { 'padding-left' : $root.isLeftPanelVisible() ? '0' : '20px' }">
-    <div class="vertical-full row-fluid panel-container">
-      <div class="content-panel home-container" data-bind="style: { 'padding-left' : $root.isLeftPanelVisible() ? '8px' : '0' }">
-        <div class="doc-browser" data-bind="component: {
-          name: 'doc-browser',
-          params: {
-            activeEntry: activeEntry
-          }
-        }"></div>
-      </div>
-    </div>
-  </div>
-</div>
-
-${ common_home.vm(True) }
-${ common_home.tour() }

+ 5 - 1
desktop/core/src/desktop/templates/hue.mako

@@ -526,7 +526,7 @@ ${ assist.assistPanel() }
         filebrowser: '/filebrowser/?is_embeddable=true',
         filebrowser: '/filebrowser/?is_embeddable=true',
         filebrowser_s3: '/filebrowser/view=S3A://?is_embeddable=true',
         filebrowser_s3: '/filebrowser/view=S3A://?is_embeddable=true',
         fileviewer: 'filebrowser/view=',
         fileviewer: 'filebrowser/view=',
-        home: '/home_embeddable',
+        home: '/home?is_embeddable=true',
         indexer: '/indexer/indexer/?is_embeddable=true',
         indexer: '/indexer/indexer/?is_embeddable=true',
         collections: '/dashboard/admin/collections?is_embeddable=true',
         collections: '/dashboard/admin/collections?is_embeddable=true',
         indexes: '/indexer/?is_embeddable=true',
         indexes: '/indexer/?is_embeddable=true',
@@ -911,6 +911,10 @@ ${ assist.assistPanel() }
           self.currentApp('notebook');
           self.currentApp('notebook');
         });
         });
 
 
+        page('/home', function(ctx){
+          self.currentApp('home');
+        });
+
         page('/', function(ctx){
         page('/', function(ctx){
         });
         });
 
 

+ 3 - 6
desktop/core/src/desktop/views.py

@@ -121,13 +121,10 @@ def home2(request, is_embeddable=False):
 
 
   apps = appmanager.get_apps_dict(request.user)
   apps = appmanager.get_apps_dict(request.user)
 
 
-  template = 'home2.mako'
-  if is_embeddable:
-    template = 'home_embeddable.mako'
-
-  return render(template, request, {
+  return render('home2.mako', request, {
     'apps': apps,
     'apps': apps,
-    'tours_and_tutorials': Settings.get_settings().tours_and_tutorials
+    'tours_and_tutorials': Settings.get_settings().tours_and_tutorials,
+    'is_embeddable': request.GET.get('is_embeddable', False)
   })
   })
 
 
 def home_embeddable(request):
 def home_embeddable(request):