Browse Source

HUE-8687 [frontend] Add custom js bundle for the login page

Some variables are not set like LOGGED_USERNAME causing the login page to break. This takes care of that by adding a separate lightweight bundle for the login page.
Johan Ahlen 6 năm trước cách đây
mục cha
commit
2d7d2cc

+ 26 - 0
desktop/core/src/desktop/js/jquery/jquery.login.js

@@ -0,0 +1,26 @@
+// 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.
+
+import $ from 'jquery';
+import 'jquery/jquery.migration';
+
+import 'ext/jquery.dataTables.1.8.2.min';
+
+import 'jquery/plugins/jquery.delayedinput';
+import 'jquery/plugins/jquery.tablescroller';
+
+window.$ = $;
+window.jQuery = $;

+ 25 - 0
desktop/core/src/desktop/js/login.js

@@ -0,0 +1,25 @@
+// 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.
+
+import 'jquery/jquery.login';
+import 'ext/bootstrap.2.3.2.min';
+import Dropzone from 'dropzone';
+import hueAnalytics from 'utils/hueAnalytics';
+import huePubSub from 'utils/huePubSub';
+
+window.Dropzone = Dropzone;
+window.hueAnalytics = hueAnalytics;
+window.huePubSub = huePubSub;

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 22
desktop/core/src/desktop/static/desktop/js/bundles/hue-bundle-1a4be08a4dac929d7c84.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 0
desktop/core/src/desktop/static/desktop/js/bundles/hue-bundle-1a4be08a4dac929d7c84.js.map


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 22 - 0
desktop/core/src/desktop/static/desktop/js/bundles/hue-bundle-b61705ac5fe672f1dbee.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 22 - 0
desktop/core/src/desktop/static/desktop/js/bundles/login-bundle-b61705ac5fe672f1dbee.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 22
desktop/core/src/desktop/static/desktop/js/bundles/sqlSyntaxWebWorker-bundle-1a4be08a4dac929d7c84.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 0
desktop/core/src/desktop/static/desktop/js/bundles/sqlSyntaxWebWorker-bundle-1a4be08a4dac929d7c84.js.map


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 22 - 0
desktop/core/src/desktop/static/desktop/js/bundles/sqlSyntaxWebWorker-bundle-b61705ac5fe672f1dbee.js


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

@@ -135,7 +135,11 @@ if USE_NEW_EDITOR.get():
   <script src="${ static('desktop/js/hue.errorcatcher.js') }"></script>
   % endif
 
-  ${ render_bundle('hue') | n,unicode }
+  % if section == "login":
+    ${ render_bundle('login') | n,unicode }
+  %else:
+    ${ render_bundle('hue') | n,unicode }
+  % endif
 
   <script src="${ static('desktop/ext/js/d3.v3.js') }"></script>
   <script src="${ static('desktop/ext/js/d3.v4.js') }"></script>

+ 1 - 1
webpack-stats.json

@@ -1 +1 @@
-{"status":"done","chunks":{"hue":[{"name":"hue-bundle-1a4be08a4dac929d7c84.js","path":"/Users/jahlen/dev/hue/desktop/core/src/desktop/static/desktop/js/bundles/hue-bundle-1a4be08a4dac929d7c84.js"},{"name":"hue-bundle-1a4be08a4dac929d7c84.js.map","path":"/Users/jahlen/dev/hue/desktop/core/src/desktop/static/desktop/js/bundles/hue-bundle-1a4be08a4dac929d7c84.js.map"}],"sqlSyntaxWebWorker":[{"name":"sqlSyntaxWebWorker-bundle-1a4be08a4dac929d7c84.js","path":"/Users/jahlen/dev/hue/desktop/core/src/desktop/static/desktop/js/bundles/sqlSyntaxWebWorker-bundle-1a4be08a4dac929d7c84.js"},{"name":"sqlSyntaxWebWorker-bundle-1a4be08a4dac929d7c84.js.map","path":"/Users/jahlen/dev/hue/desktop/core/src/desktop/static/desktop/js/bundles/sqlSyntaxWebWorker-bundle-1a4be08a4dac929d7c84.js.map"}]}}
+{"status":"done","chunks":{"hue":[{"name":"hue-bundle-b61705ac5fe672f1dbee.js","path":"/Users/jahlen/dev/hue/desktop/core/src/desktop/static/desktop/js/bundles/hue-bundle-b61705ac5fe672f1dbee.js"}],"login":[{"name":"login-bundle-b61705ac5fe672f1dbee.js","path":"/Users/jahlen/dev/hue/desktop/core/src/desktop/static/desktop/js/bundles/login-bundle-b61705ac5fe672f1dbee.js"}],"sqlSyntaxWebWorker":[{"name":"sqlSyntaxWebWorker-bundle-b61705ac5fe672f1dbee.js","path":"/Users/jahlen/dev/hue/desktop/core/src/desktop/static/desktop/js/bundles/sqlSyntaxWebWorker-bundle-b61705ac5fe672f1dbee.js"}]}}

+ 1 - 0
webpack.config.js

@@ -25,6 +25,7 @@ module.exports = {
   },
   entry: {
     hue: ['./desktop/core/src/desktop/js/hue.js'],
+    login: ['./desktop/core/src/desktop/js/login.js'],
     sqlSyntaxWebWorker: ['./desktop/core/src/desktop/js/sql/sqlSyntaxWebWorker.js'],
   },
   output: {

Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác