浏览代码

HUE-7743 [frontend] Add a DEV_EMBEDDED config flag that will render hue inside a div in the page

Johan Ahlen 8 年之前
父节点
当前提交
d23fbe11c4

+ 3 - 0
desktop/conf.dist/hue.ini

@@ -50,6 +50,9 @@
   # Enable development mode, where notably static files are not cached.
   ## dev=false
 
+  # Enable embedded development mode, where the page will be rendered inside a container div element.
+  ## dev_embedded=false
+
   # Enable or disable database debug mode.
   ## database_logging=false
 

+ 3 - 0
desktop/conf/pseudo-distributed.ini.tmpl

@@ -54,6 +54,9 @@
   # Enable development mode, where notably static files are not cached.
   dev=true
 
+  # Enable embedded development mode, where the page will be rendered inside a container div element.
+  ## dev_embedded=false
+
   # Enable or disable database debug mode.
   ## database_logging=false
 

+ 6 - 0
desktop/core/src/desktop/conf.py

@@ -1298,6 +1298,12 @@ DEV = Config("dev",
    help=_("Enable development mode, where notably static files are not cached.")
 )
 
+DEV_EMBEDDED = Config("dev_embedded",
+   type=coerce_bool,
+   default=False,
+   help=_("Enable embedded development mode, where the page will be rendered inside a container div element.")
+)
+
 HTTP_500_DEBUG_MODE = Config(
   key='http_500_debug_mode',
   help=_('Enable or disable debugging information in the 500 internal server error response. '

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

@@ -19,6 +19,7 @@
 
   from desktop import conf
   from desktop.conf import IS_EMBEDDED
+  from desktop.conf import DEV_EMBEDDED
   from desktop.views import _ko, commonshare, login_modal
   from desktop.lib.i18n import smart_unicode
   from desktop.models import PREFERENCE_IS_WELCOME_TOUR_SEEN
@@ -44,6 +45,35 @@
   <meta name="description" content="">
   <meta name="author" content="">
 
+% if DEV_EMBEDDED.get():
+  <style>
+    html {
+      height: 100%;
+      width: 100%;
+      margin: 0;
+      font-size: 1em;
+    }
+
+    body {
+      position: relative;
+      height: 100%;
+      width: 100%;
+      margin: 0;
+      padding: 0;
+      overflow: hidden;
+      background-color: pink;
+    }
+
+    .hue-embedded-container {
+      position: absolute !important;
+      top: 60px !important;
+      left: 60px !important;
+      bottom: 60px !important;
+      right: 60px !important;
+    }
+  </style>
+% endif
+
   <link href="${ static('desktop/css/roboto.css') }" rel="stylesheet">
   <link href="${ static('desktop/ext/css/font-awesome.min.css') }" rel="stylesheet">
 % if IS_EMBEDDED.get():