Sfoglia il codice sorgente

HUE-6077 [frontend] Unify page.route and open.link

Enrico Berti 8 anni fa
parent
commit
6228ca2

+ 1 - 1
apps/filebrowser/src/filebrowser/templates/listdir_components.mako

@@ -1350,7 +1350,7 @@ from filebrowser.conf import ENABLE_EXTRACT_UPLOADED_ARCHIVE
           location.hash = stripHashes(file.path);
           location.hash = stripHashes(file.path);
         } else {
         } else {
           %if is_embeddable:
           %if is_embeddable:
-          huePubSub.publish('page.route', file.url);
+          huePubSub.publish('open.link', file.url);
           %else:
           %else:
           location.href = file.url;
           location.href = file.url;
           %endif
           %endif

+ 1 - 1
apps/metastore/src/metastore/templates/metastore.mako

@@ -1172,7 +1172,7 @@ ${ components.menubar() }
       format: "json"
       format: "json"
     },function(resp) {
     },function(resp) {
       if (resp.uri_path) {
       if (resp.uri_path) {
-        huePubSub.publish('page.route', resp.uri_path );
+        huePubSub.publish('open.link', resp.uri_path);
       } else if (resp.message) {
       } else if (resp.message) {
         $(document).trigger("error", resp.message);
         $(document).trigger("error", resp.message);
       }
       }

+ 1 - 1
apps/oozie/src/oozie/static/oozie/js/workflow-editor.ko.js

@@ -1242,7 +1242,7 @@ var WorkflowEditorViewModel = function (layout_json, workflow_json, credentials_
   self.schedule = function () {
   self.schedule = function () {
     logGA('schedule');
     logGA('schedule');
     if (IS_HUE_4) {
     if (IS_HUE_4) {
-      huePubSub.publish('page.route', '/oozie/editor/coordinator/new/?workflow=' + self.workflow.uuid());
+      huePubSub.publish('open.link', '/oozie/editor/coordinator/new/?workflow=' + self.workflow.uuid());
     }
     }
     else {
     else {
       window.location.replace('/oozie/editor/coordinator/new/?workflow=' + self.workflow.uuid());
       window.location.replace('/oozie/editor/coordinator/new/?workflow=' + self.workflow.uuid());

+ 4 - 0
desktop/core/src/desktop/templates/common_header_footer_components.mako

@@ -497,6 +497,10 @@ from metadata.conf import has_optimizer, OPTIMIZER
       }
       }
     });
     });
 
 
+    // catch leaking links
+    huePubSub.subscribe('open.link', function (href) {
+      location.href = href;
+    });
 
 
     $("div.navigator ul.dropdown-menu").css("maxHeight", $(window).height() - 50);
     $("div.navigator ul.dropdown-menu").css("maxHeight", $(window).height() - 50);
     var scrollableDropdownTimeout = -1;
     var scrollableDropdownTimeout = -1;

+ 1 - 1
desktop/core/src/desktop/templates/common_notebook_ko_components.mako

@@ -366,7 +366,7 @@ except ImportError, e:
               if (IS_HUE_4) {
               if (IS_HUE_4) {
                 $(".modal-backdrop").remove();
                 $(".modal-backdrop").remove();
                 if (self.saveTarget() == 'hdfs-file' || (self.saveTarget() == 'search-index' && typeof resp.rowcount !== 'undefined')) {
                 if (self.saveTarget() == 'hdfs-file' || (self.saveTarget() == 'search-index' && typeof resp.rowcount !== 'undefined')) {
-                  huePubSub.publish('page.route', resp.watch_url);
+                  huePubSub.publish('open.link', resp.watch_url);
                 } else {
                 } else {
                   if (resp.history_uuid) {
                   if (resp.history_uuid) {
                     $("#saveResultsModal").hide();
                     $("#saveResultsModal").hide();

+ 8 - 14
desktop/core/src/desktop/templates/hue.mako

@@ -631,15 +631,6 @@ ${ smart_unicode(login_modal(request).content) | n,unicode }
           })
           })
         });
         });
 
 
-        huePubSub.subscribe('open.link', function (href) {
-          if (href.startsWith('/') && !href.startsWith('/hue')){
-            page('/hue' + href);
-          }
-          else {
-            page(href);
-          }
-        });
-
         var loadedJs = [];
         var loadedJs = [];
         var loadedCss = [];
         var loadedCss = [];
         var loadedApps = [];
         var loadedApps = [];
@@ -753,10 +744,6 @@ ${ smart_unicode(login_modal(request).content) | n,unicode }
           });
           });
         };
         };
 
 
-        huePubSub.subscribe('switch.app', function (name) {
-          self.currentApp(name);
-        });
-
         // prepend /hue to all the link on this page
         // prepend /hue to all the link on this page
         $('a[href]').each(function () {
         $('a[href]').each(function () {
           var link = $(this).attr('href');
           var link = $(this).attr('href');
@@ -887,7 +874,14 @@ ${ smart_unicode(login_modal(request).content) | n,unicode }
 
 
         page();
         page();
 
 
-        huePubSub.subscribe('page.route', page);
+        huePubSub.subscribe('open.link', function (href) {
+          if (href.startsWith('/') && !href.startsWith('/hue')){
+            page('/hue' + href);
+          }
+          else {
+            page(href);
+          }
+        });
       };
       };
 
 
       var onePageViewModel = new OnePageViewModel();
       var onePageViewModel = new OnePageViewModel();

+ 1 - 1
desktop/core/src/desktop/templates/ko_components.mako

@@ -331,7 +331,7 @@ from desktop.views import _ko
                     if (notebook.onSuccessUrl() == 'assist.db.refresh') { // TODO: Similar if in in FB directory, also refresh FB dir
                     if (notebook.onSuccessUrl() == 'assist.db.refresh') { // TODO: Similar if in in FB directory, also refresh FB dir
                       huePubSub.publish('assist.db.refresh', { sourceType: 'hive' });
                       huePubSub.publish('assist.db.refresh', { sourceType: 'hive' });
                     } else {
                     } else {
-                      huePubSub.publish('page.route', notebook.onSuccessUrl());
+                      huePubSub.publish('open.link', notebook.onSuccessUrl());
                     }
                     }
                   }
                   }
                 } else { // Perform last DROP statement execute
                 } else { // Perform last DROP statement execute