Pārlūkot izejas kodu

HUE-826 [proxyapp] Support ini parameter for URL

For example, in the hue.ini the URL can be overriden:

[navigator]
url=http://gethue.com
Romain Rigaux 12 gadi atpakaļ
vecāks
revīzija
2e9e2c2

+ 1 - 1
apps/beeswax/src/beeswax/server/hive_server2_lib.py

@@ -525,7 +525,7 @@ class HiveServerClient:
 
 
   def explain(self, query):
-    query_statement =  query.get_query_statement(0)
+    query_statement = query.get_query_statement(0)
     return self.execute_query_statement('EXPLAIN %s' % query_statement)
 
 

+ 4 - 2
desktop/core/src/desktop/app_template_proxy/src/app_name/templates/index.mako

@@ -13,7 +13,10 @@
 ## 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 ${app_name}.conf import URL %>
+
 ${'<'}%namespace name="shared" file="shared_components.mako" />
 
 ${'$'}{commonheader("${" ".join(word.capitalize() for word in app_name.split("_"))}", "${app_name}", user, "28px") | n,unicode}
@@ -28,13 +31,12 @@ ${'#'}# Main body
   }
 </style>
 
-<iframe id="appframe" src="${app_url}"></iframe>
+<iframe id="appframe" src="${'${'} URL.get() if URL.get() else '${ app_url }' }"></iframe>
 
 <script type="text/javascript">
   $(document).ready(function () {
     var _resizeTimeout = -1;
     $(window).on("resize", function () {
-      console.log("resize")
       window.clearTimeout(_resizeTimeout);
       _resizeTimeout = window.setTimeout(resizeAppframe, 300);
     });

+ 3 - 3
desktop/core/src/desktop/management/commands/create_proxy_app.py

@@ -29,12 +29,12 @@ LOG = logging.getLogger(__name__)
 
 class Command(BaseCommand):
   help = _("Creates a Hue proxy application directory structure.")
-  args = "[appname]"
+  args = "app_name app_web_url [app_dir]"
   label = _('application name')
 
   def handle(self, *args, **options):
     if len(args) > 3 or len(args) == 0:
-      raise CommandError(_("Expected arguments: app_name [app_url] [app_dir]"))
+      raise CommandError(_("Expected arguments: app_name app_web_url [app_dir]"))
     app_name = args[0]
     if len(args) == 2:
       app_url = args[1]
@@ -46,7 +46,7 @@ class Command(BaseCommand):
       app_url = "http://gethue.com"
       app_dir = os.getcwd()
 
-    app_template = os.path.abspath(os.path.join(os.path.dirname(__file__),'..','..','app_template_proxy'))
+    app_template = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', 'app_template_proxy'))
     assert os.path.isdir(app_template), _("App template dir missing: %(template)s.") % {'template': app_template}
     app_dir = os.path.join(app_dir, app_name)