Browse Source

HUE-3294 [assist] Adding refresh and filter icons to document panel

No-op currently
Romain Rigaux 9 years ago
parent
commit
51a5b6c

+ 1 - 1
desktop/core/src/desktop/static/desktop/css/responsive.css

@@ -47,7 +47,7 @@ body {
   position: relative;
   flex: 1;
   height: 38px;
-  background-color: #31516A;
+  background-color: #003F6C;
   width: 100%;
   padding: 1em 0;
 }

+ 5 - 0
desktop/core/src/desktop/static/desktop/js/apiHelper.js

@@ -70,6 +70,10 @@ var ApiHelper = (function () {
       $.totalStorage("hue.assist." + self.getTotalStorageUserPrefix('hbase'), {});
     });
 
+    huePubSub.subscribe('assist.clear.document.cache', function () {
+      $.totalStorage("hue.assist." + self.getTotalStorageUserPrefix('document'), {});
+    });
+
     huePubSub.subscribe('assist.clear.all.caches', function () {
       huePubSub.publish('assist.clear.db.cache', {
         sourceType: 'hive',
@@ -79,6 +83,7 @@ var ApiHelper = (function () {
       huePubSub.publish('assist.clear.s3.cache');
       huePubSub.publish('assist.clear.collections.cache');
       huePubSub.publish('assist.clear.hbase.cache');
+      huePubSub.publish('assist.clear.document.cache');
     });
   }
 

+ 3 - 0
desktop/core/src/desktop/static/desktop/js/document/hueFileEntry.js

@@ -15,6 +15,9 @@
 // limitations under the License.
 
 var HueFileEntry = (function () {
+  var self = this;
+  self.loading = ko.observable(false);
+ 
   var sorts = {
     defaultAsc: function (a, b) {
       if (a.isDirectory() && !b.isDirectory()) {

+ 22 - 4
desktop/core/src/desktop/templates/assist.mako

@@ -808,9 +808,18 @@ from metadata.conf import has_navigator
     <span data-bind="text: definition().name"></span>
   </script>
 
-  <script type="text/html" id="assist-file-panel">
-    <div class="assist-flex-header assist-breadcrumb">
+  <script type="text/html" id="assist-document-header-actions">
+    <div class="assist-header-actions" style="margin-top: -1px;">
+      <a class="inactive-action" href="javascript:void(0)"><i class="pointer fa fa-filter" title="${_('Filter')}"></i></a>
+      <a class="inactive-action" href="javascript:void(0)" data-bind="click: function () { huePubSub.publish('assist.file.refresh'); }"><i class="pointer fa fa-refresh" data-bind="css: { 'fa-spin blue' : loading }" title="${_('Manual refresh')}"></i></a>
+    </div>
+  </script>
+
+  <script type="text/html" id="assist-document-panel">
+  <div class="assist-inner-panel">
+    <div class="assist-flex-header">
       <!-- ko with: activeEntry -->
+      <div class="assist-inner-header assist-breadcrumb">
       <!-- ko ifnot: isRoot -->
       <a href="javascript: void(0);" data-bind="click: function () { parent.makeActive(); }">
         <i class="fa fa-chevron-left" style="font-size: 15px;margin-right:8px;"></i>
@@ -825,6 +834,9 @@ from metadata.conf import has_navigator
         <span style="font-size: 14px;line-height: 16px;vertical-align: top;">/</span>
       </div>
       <!-- /ko -->
+
+      <!-- ko template: 'assist-document-header-actions' --><!-- /ko -->
+      </div>
       <!-- /ko -->
     </div>
     <div class="assist-flex-fill assist-file-scrollable">
@@ -864,12 +876,13 @@ from metadata.conf import has_navigator
       <!-- ko template: { if: searchActive() && searchInput() !== '' && navigatorEnabled(), name: 'nav-search-result' } --><!-- /ko -->
       <!-- /ko -->
     </div>
+  </div>
   </script>
 
   <script type="text/html" id="assist-documents-inner-panel">
     <div class="assist-inner-panel">
       <div class="assist-flex-panel">
-        <!-- ko template: 'assist-file-panel' --><!-- /ko -->
+        <!-- ko template: 'assist-document-panel' --><!-- /ko -->
       </div>
     </div>
   </script>
@@ -885,7 +898,7 @@ from metadata.conf import has_navigator
     <div class="assist-inner-panel">
       <div class="assist-flex-panel">
         <!-- ko with: selectedCollectionEntry -->
-        <div class="assist-inner-header assist-breadcrumb" >
+        <div class="assist-inner-header assist-breadcrumb">
           ${_('Collections')}
           <!-- ko template: 'assist-collections-header-actions' --><!-- /ko -->
         </div>
@@ -1472,6 +1485,11 @@ from metadata.conf import has_navigator
             type: 'directory'
           }
         }));
+
+        huePubSub.subscribe('assist.document.refresh', function () {
+          huePubSub.publish('assist.clear.document.cache');
+          self.reload();
+        });
       }
 
       AssistDocumentsPanel.prototype.init = function () {