浏览代码

HUE-7743 [frontend] Only use knockout deferred updates when supported

Knockout is supplied from the page outside the Hue container in embedded mode and deferred updates is only available for 3.4 and above.
Johan Ahlen 8 年之前
父节点
当前提交
103b6b8

+ 3 - 1
apps/beeswax/src/beeswax/templates/create_database.mako

@@ -222,7 +222,9 @@ ${ assist.assistPanel() }
 
 
   (function () {
   (function () {
 
 
-    ko.options.deferUpdates = true;
+    if (ko.options) {
+      ko.options.deferUpdates = true;
+    }
 
 
     function CreateDatabaseViewModel() {
     function CreateDatabaseViewModel() {
       var self = this;
       var self = this;

+ 3 - 1
apps/beeswax/src/beeswax/templates/create_table_manually.mako

@@ -545,7 +545,9 @@ ${ assist.assistPanel() }
 
 
 <script type="text/javascript">
 <script type="text/javascript">
   (function () {
   (function () {
-    ko.options.deferUpdates = true;
+    if (ko.options) {
+      ko.options.deferUpdates = true;
+    }
 
 
     function CreateTableViewModel() {
     function CreateTableViewModel() {
       var self = this;
       var self = this;

+ 3 - 1
apps/beeswax/src/beeswax/templates/import_wizard_choose_delimiter.mako

@@ -184,7 +184,9 @@ ${ assist.assistPanel() }
 
 
 <script type="text/javascript">
 <script type="text/javascript">
   (function () {
   (function () {
-    ko.options.deferUpdates = true;
+    if (ko.options) {
+      ko.options.deferUpdates = true;
+    }
 
 
     function ImportWizardChooseDelimiterViewModel() {
     function ImportWizardChooseDelimiterViewModel() {
       var self = this;
       var self = this;

+ 3 - 1
apps/beeswax/src/beeswax/templates/import_wizard_choose_file.mako

@@ -191,7 +191,9 @@ ${ assist.assistPanel() }
 
 
 <script type="text/javascript">
 <script type="text/javascript">
   (function () {
   (function () {
-    ko.options.deferUpdates = true;
+    if (ko.options) {
+      ko.options.deferUpdates = true;
+    }
 
 
     function ImportWizardChooseFileViewModel() {
     function ImportWizardChooseFileViewModel() {
       var self = this;
       var self = this;

+ 3 - 1
apps/beeswax/src/beeswax/templates/import_wizard_define_columns.mako

@@ -219,7 +219,9 @@ ${ assist.assistPanel() }
 
 
 <script type="text/javascript">
 <script type="text/javascript">
   (function () {
   (function () {
-    ko.options.deferUpdates = true;
+    if (ko.options) {
+      ko.options.deferUpdates = true;
+    }
 
 
     function ImportWizardDefineColumnsViewModel() {
     function ImportWizardDefineColumnsViewModel() {
       var self = this;
       var self = this;

+ 3 - 2
apps/metastore/src/metastore/templates/metastore.mako

@@ -1285,8 +1285,9 @@ ${ components.menubar(is_embeddable) }
 
 
 
 
   (function () {
   (function () {
-
-    ko.options.deferUpdates = true;
+    if (ko.options) {
+      ko.options.deferUpdates = true;
+    }
 
 
     $(document).ready(function () {
     $(document).ready(function () {
       var options = {
       var options = {

+ 3 - 1
apps/security/src/security/templates/hive.mako

@@ -554,7 +554,9 @@ ${ tree.import_templates(itemClick='$root.assist.setPath', iconClick='$root.assi
 
 
 <script type="text/javascript">
 <script type="text/javascript">
   (function () {
   (function () {
-    ko.options.deferUpdates = true;
+    if (ko.options) {
+      ko.options.deferUpdates = true;
+    }
 
 
     huePubSub.subscribe('show.delete.privilege.modal', function () {
     huePubSub.subscribe('show.delete.privilege.modal', function () {
       $('#deletePrivilegeModal').modal('show');
       $('#deletePrivilegeModal').modal('show');

+ 3 - 1
desktop/core/src/desktop/templates/assist_m.mako

@@ -65,7 +65,9 @@ ${ assist.assistPanel() }
 
 
 <script type="text/javascript">
 <script type="text/javascript">
   (function () {
   (function () {
-    ko.options.deferUpdates = true;
+    if (ko.options) {
+      ko.options.deferUpdates = true;
+    }
 
 
     function AssistViewModel(options) {
     function AssistViewModel(options) {
       var self = this;
       var self = this;

+ 3 - 1
desktop/core/src/desktop/templates/common_dashboard.mako

@@ -37,7 +37,9 @@
 
 
   %if with_deferred:
   %if with_deferred:
   <script type="text/javascript">
   <script type="text/javascript">
-    ko.options.deferUpdates = true;
+    if (ko.options) {
+      ko.options.deferUpdates = true;
+    }
   </script>
   </script>
   %endif
   %endif
 </%def>
 </%def>

+ 3 - 1
desktop/core/src/desktop/templates/common_home.mako

@@ -65,7 +65,9 @@
 
 
 <script type="text/javascript">
 <script type="text/javascript">
   (function () {
   (function () {
-    ko.options.deferUpdates = true;
+    if (ko.options) {
+      ko.options.deferUpdates = true;
+    }
 
 
     var userGroups = [];
     var userGroups = [];
     % for group in user.groups.all():
     % for group in user.groups.all():

+ 3 - 2
desktop/libs/indexer/src/indexer/templates/importer.mako

@@ -1036,8 +1036,9 @@ ${ assist.assistPanel() }
   % endif
   % endif
 
 
   (function () {
   (function () {
-
-    ko.options.deferUpdates = true;
+    if (ko.options) {
+      ko.options.deferUpdates = true;
+    }
 
 
     var MAPPINGS = {
     var MAPPINGS = {
       SOLR_TO_HIVE: {
       SOLR_TO_HIVE: {

+ 3 - 1
desktop/libs/indexer/src/indexer/templates/indexer.mako

@@ -491,7 +491,9 @@ ${ assist.assistPanel() }
 
 
 <script type="text/javascript">
 <script type="text/javascript">
   (function () {
   (function () {
-    ko.options.deferUpdates = true;
+    if (ko.options) {
+      ko.options.deferUpdates = true;
+    }
 
 
     var fieldNum = 0;
     var fieldNum = 0;
 
 

+ 3 - 1
desktop/libs/notebook/src/notebook/templates/editor_components.mako

@@ -2689,7 +2689,9 @@ ${ sqlSyntaxDropdown.sqlSyntaxDropdown() }
   }
   }
 
 
   (function () {
   (function () {
-    ko.options.deferUpdates = true;
+    if (ko.options) {
+      ko.options.deferUpdates = true;
+    }
 
 
     var VIEW_MODEL_OPTIONS = $.extend(${ options_json | n,unicode,antixss }, {
     var VIEW_MODEL_OPTIONS = $.extend(${ options_json | n,unicode,antixss }, {
       huePubSubId: HUE_PUB_SUB_EDITOR_ID,
       huePubSubId: HUE_PUB_SUB_EDITOR_ID,

+ 3 - 1
desktop/libs/notebook/src/notebook/templates/editor_m.mako

@@ -178,7 +178,9 @@ ${ commonheader_m(editor_type, editor_type, user, request, "68px") | n,unicode }
 ${ assist.assistJSModels() }
 ${ assist.assistJSModels() }
 
 
 <script type="text/javascript">
 <script type="text/javascript">
-  ko.options.deferUpdates = true;
+  if (ko.options) {
+    ko.options.deferUpdates = true;
+  }
 
 
   ace.config.set("basePath", "/static/desktop/js/ace");
   ace.config.set("basePath", "/static/desktop/js/ace");