Переглянути джерело

HUE-7743 [frontend] Fix js error when the IS_EMBEDDED flag isn't defined

Johan Ahlen 7 роки тому
батько
коміт
bc8eb74e7d

+ 2 - 2
desktop/core/src/desktop/static/desktop/js/hue.utils.js

@@ -224,7 +224,7 @@ window.hueUtils = window.hueUtils || (function () {
   };
 
   hueUtils.changeURL = function (newURL) {
-    if (IS_EMBEDDED) {
+    if (typeof IS_EMBEDDED !== 'undefined' && IS_EMBEDDED) {
       newURL = window.location.pathname + window.location.search + '#!' + newURL.replace('/hue', '');
     } else {
       if (window.location.hash !== '' && newURL.indexOf('#') === -1){
@@ -239,7 +239,7 @@ window.hueUtils = window.hueUtils || (function () {
   };
 
   hueUtils.changeURLParameter = function (param, value) {
-    if (IS_EMBEDDED) {
+    if (typeof IS_EMBEDDED !== 'undefined' && IS_EMBEDDED) {
       var currentUrl = window.location.hash.replace('#!', '');
       var parts = currentUrl.split('?');
       var path = parts[0];

+ 1 - 1
desktop/libs/notebook/src/notebook/static/notebook/js/notebook.ko.js

@@ -2090,7 +2090,7 @@ var EditorViewModel = (function() {
     self.history = ko.observableArray(vm.selectedNotebook() && vm.selectedNotebook().history().length > 0 && vm.selectedNotebook().history()[0].type == self.type() ? vm.selectedNotebook().history() : []);
     self.history.subscribe(function(val) {
       if (self.id() == null && val.length == 0 && self.historyFilter() === '' && ! vm.isNotificationManager()) {
-        self.snippets()[0].currentQueryTab(IS_EMBEDDED ? 'queryHistory' : 'savedQueries');
+        self.snippets()[0].currentQueryTab((typeof IS_EMBEDDED !== 'undefined' && IS_EMBEDDED) ? 'queryHistory' : 'savedQueries');
       }
     });
     self.historyFilter = ko.observable('');