Prechádzať zdrojové kódy

HUE-6352 [editor] Do not load twice the editor the first time

Romain Rigaux 8 rokov pred
rodič
commit
f0b64b0bcb
1 zmenil súbory, kde vykonal 16 pridanie a 7 odobranie
  1. 16 7
      desktop/core/src/desktop/templates/hue.mako

+ 16 - 7
desktop/core/src/desktop/templates/hue.mako

@@ -771,13 +771,22 @@ ${ smart_unicode(login_modal(request).content) | n,unicode }
           { url: '/editor', app: function () {
             // Defer to allow window.location param update
             _.defer(function () {
-              self.loadApp('editor');
-              if (window.location.getParameter('editor') !== '') {
-                self.getActiveAppViewModel(function (viewModel) {
-                  viewModel.openNotebook(window.location.getParameter('editor'));
-                });
-              } else if (window.location.getParameter('type') !== '') {
-                self.changeEditorType(window.location.getParameter('type'));
+              if (typeof self.embeddable_cache['editor'] === 'undefined'){
+                if (window.location.getParameter('editor') !== '') {
+                  self.extraEmbeddableURLParams('&editor=' + window.location.getParameter('editor'));
+                } else if (window.location.getParameter('type') !== '') {
+                  self.extraEmbeddableURLParams('&type=' + window.location.getParameter('type'));
+                }
+                self.loadApp('editor');
+              } else {
+                self.loadApp('editor');
+                if (window.location.getParameter('editor') !== '') {
+                  self.getActiveAppViewModel(function (viewModel) {
+                    viewModel.openNotebook(window.location.getParameter('editor'));
+                  });
+                } else if (window.location.getParameter('type') !== '') {
+                  self.changeEditorType(window.location.getParameter('type'));
+                }
               }
             });
           }},