Ver código fonte

HUE-6147 [assist] Add initial right-click context menu for HDFS

Johan Ahlen 8 anos atrás
pai
commit
b948465

+ 0 - 1
desktop/core/src/desktop/static/desktop/js/ko.hue-bindings.js

@@ -84,7 +84,6 @@
       if (IS_HUE_4) {
       if (IS_HUE_4) {
         ko.bindingHandlers.click.init(element, function() {
         ko.bindingHandlers.click.init(element, function() {
           return function () {
           return function () {
-            console.log('open ' + ko.unwrap(valueAccessor()));
             huePubSub.publish('open.link', ko.unwrap(valueAccessor()));
             huePubSub.publish('open.link', ko.unwrap(valueAccessor()));
           }
           }
         }, allBindings, viewModel, bindingContext);
         }, allBindings, viewModel, bindingContext);

+ 14 - 1
desktop/core/src/desktop/templates/assist.mako

@@ -146,6 +146,19 @@ from notebook.conf import get_ordered_interpreters
     </li>
     </li>
   </script>
   </script>
 
 
+  <script type="text/html" id="hdfs-context-items">
+    <li><a href="javascript:void(0);" data-bind="hueLink: definition.url"><i class="fa fa-fw fa-info"></i> ${ _('Open in File Browser') }</a></li>
+    <!-- ko if: $currentApp() === 'editor' -->
+    <li><a href="javascript:void(0);" data-bind="click: dblClick"><i class="fa fa-fw fa-paste"></i> ${ _('Insert at cursor') }</a></li>
+    ## Generate create table statement
+    <!-- /ko -->
+    ## ------
+    ## Move
+    ## Copy
+    ## Rename
+    ## Delete
+  </script>
+
   <script type="text/html" id="assist-database-entry">
   <script type="text/html" id="assist-database-entry">
     <li class="assist-table" data-bind="appAwareTemplateContextMenu: { template: 'sql-context-items', scrollContainer: '.assist-db-scrollable' }, visibleOnHover: { selector: '.database-actions' }">
     <li class="assist-table" data-bind="appAwareTemplateContextMenu: { template: 'sql-context-items', scrollContainer: '.assist-db-scrollable' }, visibleOnHover: { selector: '.database-actions' }">
       <!-- ko template: { name: 'assist-database-actions' } --><!-- /ko -->
       <!-- ko template: { name: 'assist-database-actions' } --><!-- /ko -->
@@ -426,7 +439,7 @@ from notebook.conf import get_ordered_interpreters
       <div data-bind="visible: ! loading() && ! hasErrors()" style="position: relative;">
       <div data-bind="visible: ! loading() && ! hasErrors()" style="position: relative;">
         <!-- ko hueSpinner: { spin: loadingMore, overlay: true } --><!-- /ko -->
         <!-- ko hueSpinner: { spin: loadingMore, overlay: true } --><!-- /ko -->
         <ul class="assist-tables" data-bind="foreachVisible: { data: entries, minHeight: 20, container: '.assist-hdfs-scrollable', fetchMore: $data.fetchMore.bind($data) }">
         <ul class="assist-tables" data-bind="foreachVisible: { data: entries, minHeight: 20, container: '.assist-hdfs-scrollable', fetchMore: $data.fetchMore.bind($data) }">
-          <li class="assist-entry assist-table-link" style="position: relative;" data-bind="visibleOnHover: { 'selector': '.assist-actions' }">
+          <li class="assist-entry assist-table-link" style="position: relative;" data-bind="appAwareTemplateContextMenu: { template: 'hdfs-context-items', scrollContainer: '.assist-db-scrollable' }, visibleOnHover: { 'selector': '.assist-actions' }">
             <div class="assist-actions table-actions" style="opacity: 0;" >
             <div class="assist-actions table-actions" style="opacity: 0;" >
               <a style="padding: 0 3px;" class="inactive-action" href="javascript:void(0);" data-bind="templatePopover : { contentTemplate: 'hdfs-details-content', titleTemplate: 'hdfs-details-title', minWidth: '320px' }">
               <a style="padding: 0 3px;" class="inactive-action" href="javascript:void(0);" data-bind="templatePopover : { contentTemplate: 'hdfs-details-content', titleTemplate: 'hdfs-details-title', minWidth: '320px' }">
                 <i class='fa fa-info' title="${ _('Details') }"></i>
                 <i class='fa fa-info' title="${ _('Details') }"></i>

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

@@ -864,8 +864,7 @@ ${ smart_unicode(login_modal(request).content) | n,unicode }
         huePubSub.subscribe('open.link', function (href) {
         huePubSub.subscribe('open.link', function (href) {
           if (href.startsWith('/') && !href.startsWith('/hue')){
           if (href.startsWith('/') && !href.startsWith('/hue')){
             page('/hue' + href);
             page('/hue' + href);
-          }
-          else {
+          } else {
             page(href);
             page(href);
           }
           }
         });
         });