Explorar o código

HUE-6091 [core] Fix routing for Metastore

Enrico Berti %!s(int64=8) %!d(string=hai) anos
pai
achega
000974a

+ 2 - 2
apps/metastore/src/metastore/static/metastore/js/metastore.ko.js

@@ -803,7 +803,7 @@ var MetastoreViewModel = (function () {
     huePubSub.subscribe('metastore.url.change', function () {
       var prefix = '/metastore/';
       if (self.isHue4()){
-        prefix = '?app=metastore&path=';
+        prefix = '/hue' + prefix;
       }
       if (self.database() && self.database().table()) {
         hueUtils.changeURL(prefix + 'table/' + self.database().name + '/' + self.database().table().name);
@@ -956,7 +956,7 @@ var MetastoreViewModel = (function () {
   MetastoreViewModel.prototype.loadURL = function () {
     var self = this;
 
-    var path = (IS_HUE_4 ? window.location.getParameter('path', true) : window.location.pathname);
+    var path = (IS_HUE_4 ? window.location.pathname.substr(4) : window.location.pathname);
     if (!path) {
       path = '/metastore/tables';
     }

+ 2 - 2
apps/metastore/src/metastore/urls.py

@@ -25,9 +25,9 @@ urlpatterns = patterns('metastore.views',
   url(r'^databases/(?P<database>\w+)/alter$', 'alter_database', name='alter_database'),
   url(r'^databases/(?P<database>\w+)/metadata$', 'get_database_metadata', name='get_database_metadata'),
 
-  url(r'^tables/(?P<database>\w+)?$', 'show_tables', name='show_tables'),
+  url(r'^tables/(?P<database>\w+)/?$', 'show_tables', name='show_tables'),
   url(r'^tables/drop/(?P<database>\w+)$', 'drop_table', name='drop_table'),
-  url(r'^table/(?P<database>\w+)/(?P<table>\w+)$', 'describe_table', name='describe_table'),
+  url(r'^table/(?P<database>\w+)/(?P<table>\w+)/?$', 'describe_table', name='describe_table'),
   url(r'^table/(?P<database>\w+)/(?P<table>\w+)/alter$', 'alter_table', name='alter_table'),
   url(r'^table/(?P<database>\w+)/(?P<table>\w+)/metadata$', 'get_table_metadata', name='get_table_metadata'),
   url(r'^table/(?P<database>\w+)/(?P<table>\w+)/load$', 'load_table', name='load_table'),

+ 3 - 2
desktop/core/src/desktop/templates/hue.mako

@@ -522,7 +522,7 @@ ${ assist.assistPanel() }
         500: '/500',
         editor: '/editor',
         notebook: '/notebook',
-        metastore: '/metastore/tables/',
+        metastore: '/metastore/*',
         dashboard: '/dashboard/new_search',
         oozie_workflow: '/oozie/editor/workflow/new/',
         oozie_coordinator: '/oozie/editor/coordinator/new/',
@@ -873,7 +873,8 @@ ${ assist.assistPanel() }
           self.loadApp('oozie_bundle');
         });
 
-        page('/metastore/tables/', function(ctx){
+        page('/metastore/*', function(ctx){
+          self.currentContextParams(ctx.params);
           self.loadApp('metastore');
         });