Browse Source

HUE-5810 [assist] Open assist documents directly in responsive

Johan Ahlen 8 years ago
parent
commit
16430ed

+ 10 - 7
desktop/core/src/desktop/static/desktop/js/document/hueFileEntry.js

@@ -408,13 +408,16 @@ var HueFileEntry = (function () {
       if (!self.loaded()) {
       if (!self.loaded()) {
         self.load();
         self.load();
       }
       }
-    }
-    else {
-      if (e && ((e.which || e.button) !== 1 || (e.ctrlKey || e.shiftKey || e.metaKey))) {
-        window.open(self.definition().absoluteUrl);
-      }
-      else {
-        window.location.href = self.definition().absoluteUrl;
+    } else {
+      if (IS_HUE_4) {
+        huePubSub.publish('open.link', self.definition().absoluteUrl);
+      } else {
+        if (e && ((e.which || e.button) !== 1 || (e.ctrlKey || e.shiftKey || e.metaKey))) {
+          window.open(self.definition().absoluteUrl);
+        }
+        else {
+          window.location.href = self.definition().absoluteUrl;
+        }
       }
       }
     }
     }
   };
   };

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

@@ -153,6 +153,11 @@ if USE_NEW_EDITOR.get():
   ${ koComponents.all() }
   ${ koComponents.all() }
 
 
   ${ commonHeaderFooterComponents.header_pollers(user, is_s3_enabled, apps) }
   ${ commonHeaderFooterComponents.header_pollers(user, is_s3_enabled, apps) }
+
+  <script type="text/javascript" charset="utf-8">
+    var IS_HUE_4 = false;
+  </script>
+
 </head>
 </head>
 <body>
 <body>
 
 

+ 21 - 19
desktop/core/src/desktop/templates/responsive.mako

@@ -50,6 +50,11 @@
   <link href="${ static('desktop/css/cui.css') }" rel="stylesheet">
   <link href="${ static('desktop/css/cui.css') }" rel="stylesheet">
 
 
   ${ commonHeaderFooterComponents.header_i18n_redirection(user, is_s3_enabled, apps) }
   ${ commonHeaderFooterComponents.header_i18n_redirection(user, is_s3_enabled, apps) }
+
+  <script type="text/javascript" charset="utf-8">
+    var IS_HUE_4 = true;
+  </script>
+
 </head>
 </head>
 
 
 <body>
 <body>
@@ -648,41 +653,38 @@ ${ assist.assistPanel() }
 
 
         huePubSub.subscribe('open.link', function (href) {
         huePubSub.subscribe('open.link', function (href) {
           if (href.startsWith('/notebook/editor')){
           if (href.startsWith('/notebook/editor')){
-            if (location.getParameter('type') !== ''){
+            if (hueUtils.getSearchParameter(href, 'editor') !== '') {
+              hueUtils.changeURLParameter('editor', hueUtils.getSearchParameter(href, 'editor'));
+              self.currentApp('editor')
+              self.getActiveAppViewModel(function (viewModel) {
+                viewModel.openNotebook(hueUtils.getSearchParameter(href, 'editor'));
+              })
+            } else if (location.getParameter('type') !== ''){
               if (hueUtils.getSearchParameter(href, 'type') !== '' && hueUtils.getSearchParameter(href, 'type') !== location.getParameter('type')) {
               if (hueUtils.getSearchParameter(href, 'type') !== '' && hueUtils.getSearchParameter(href, 'type') !== location.getParameter('type')) {
                 self.changeEditorType(hueUtils.getSearchParameter(href, 'type'));
                 self.changeEditorType(hueUtils.getSearchParameter(href, 'type'));
               }
               }
-            }
-            else {
+            } else {
               if (hueUtils.getSearchParameter(href, 'type') !== ''){
               if (hueUtils.getSearchParameter(href, 'type') !== ''){
                 self.changeEditorType(hueUtils.getSearchParameter(href, 'type'));
                 self.changeEditorType(hueUtils.getSearchParameter(href, 'type'));
-              }
-              else {
+              } else {
                 self.changeEditorType('hive');
                 self.changeEditorType('hive');
               }
               }
               self.currentApp('editor')
               self.currentApp('editor')
             }
             }
-          }
-          else if (href.startsWith('/notebook')){
+          } else if (href.startsWith('/notebook')){
             self.currentApp('notebook');
             self.currentApp('notebook');
-          }
-          else if (href.startsWith('/pig')){
+          } else if (href.startsWith('/pig')){
             self.changeEditorType('pig');
             self.changeEditorType('pig');
             self.currentApp('editor');
             self.currentApp('editor');
-          }
-          else if (href.startsWith('/search')){
+          } else if (href.startsWith('/search')){
             self.currentApp('search');
             self.currentApp('search');
-          }
-          else if (href.startsWith('/oozie/editor/workflow/new')){
+          } else if (href.startsWith('/oozie/editor/workflow/new')){
             self.currentApp('oozie_workflow');
             self.currentApp('oozie_workflow');
-          }
-          else if (href.startsWith('/oozie/editor/coordinator/new')){
+          } else if (href.startsWith('/oozie/editor/coordinator/new')){
             self.currentApp('oozie_coordinator');
             self.currentApp('oozie_coordinator');
-          }
-          else if (href.startsWith('/oozie/editor/bundle/new')){
+          } else if (href.startsWith('/oozie/editor/bundle/new')){
             self.currentApp('oozie_bundle');
             self.currentApp('oozie_bundle');
-          }
-          else if (href.startsWith('/filebrowser')){
+          } else if (href.startsWith('/filebrowser')){
             self.currentApp('filebrowser');
             self.currentApp('filebrowser');
           }
           }
         });
         });