Browse Source

[dashboard] Remove search bar from report mode

Enrico Berti 7 years ago
parent
commit
ceb80d979e

+ 2 - 0
desktop/core/src/desktop/templates/assist.mako

@@ -2279,8 +2279,10 @@ from desktop.views import _ko
               <span class="assist-entry">
                 <i class="hue-warning fa fa-fw muted valign-middle fa-warning"></i>
                 <!-- ko with: catalogEntry -->
+                <!-- ko if: typeof reload !== 'undefined' -->
                 <span data-bind="text: getDisplayName()"></span> <a class="inactive-action" href="javascript: void(0);" data-bind="click: reload"><i class="fa fa-refresh" data-bind="css: { 'fa-spin': reloading }"></i></a>
                 <!-- /ko -->
+                <!-- /ko -->
               </span>
             </li>
             <!-- /ko -->

File diff suppressed because it is too large
+ 0 - 0
desktop/libs/dashboard/src/dashboard/static/dashboard/css/search.css


+ 6 - 3
desktop/libs/dashboard/src/dashboard/static/dashboard/js/search.ko.js

@@ -2175,7 +2175,7 @@ var SearchViewModel = function (collection_json, query_json, initial_json, has_g
       self.isToolbarVisible(self.isEditing());
       self.initial.init();
       self.collection.syncFields();
-      if (self.collection.engine() == 'solr') {
+      if (self.collection.engine() === 'solr' || self.collection.engine() === 'report') {
         self.search(callback);
       }
     }
@@ -2322,7 +2322,7 @@ var SearchViewModel = function (collection_json, query_json, initial_json, has_g
       hueAnalytics.log('dashboard', 'search');
       self.isRetrievingResults(true);
 
-      if (! self.collection.name()) {
+      if (!self.collection.name()) {
         return;
       }
 
@@ -2417,7 +2417,7 @@ var SearchViewModel = function (collection_json, query_json, initial_json, has_g
             huePubSub.publish('charts.state');
             data = JSON.bigdataParse(data);
             try {
-              if (self.collection.engine() == 'solr') {
+              if (self.collection.engine() === 'solr') {
                 self._make_grid_result(data, callback);
               } else {
                 self.collection.queryResult(new QueryResult(self, {
@@ -2427,6 +2427,9 @@ var SearchViewModel = function (collection_json, query_json, initial_json, has_g
                   progress: 0,
                 }));
                 self.checkStatus(self.collection);
+                if (callback) {
+                  callback();
+                }
               }
             }
             catch (e) {

+ 8 - 0
desktop/libs/dashboard/src/dashboard/static/dashboard/less/search.less

@@ -119,10 +119,18 @@
           .flex(1 1 120px);
           white-space: nowrap;
 
+
           > div {
             border-radius: 4px 0 0 4px;
             border-right: none;
           }
+          &.report-mode {
+            .flex(none);
+            > div {
+              border-right: 1px solid @cui-gray-400;
+              border-radius: 4px;
+            }
+          }
         }
 
         .search-bar-query-operations {

+ 12 - 3
desktop/libs/dashboard/src/dashboard/templates/common_search.mako

@@ -90,11 +90,12 @@ from dashboard.conf import USE_GRIDSTER, USE_NEW_ADD_METHOD, HAS_REPORT_ENABLED,
 
       <form class="form-search" style="margin: 0" data-bind="submit: searchBtn, visible: columns().length != 0">
         <div class="search-bar-query-container">
-          <div class="search-bar-collection">
+          <div class="search-bar-collection" data-bind="css: { 'report-mode': $root.collection.engine() === 'report' }">
             <div class="selectMask">
               <span data-bind="editable: collection.label, editableOptions: { enabled: true, placement: 'right' }"></span>
             </div>
           </div>
+          <!-- ko if: $root.collection.engine() !== 'report' -->
           <div class="search-bar-query" data-bind="foreach: query.qs">
 
             <div data-bind="component: { name: 'hue-simple-ace-editor', params: {
@@ -113,10 +114,13 @@ from dashboard.conf import USE_GRIDSTER, USE_NEW_ADD_METHOD, HAS_REPORT_ENABLED,
               <a class="btn flat-left" href="javascript:void(0)" data-bind="click: $root.query.removeQ"><i class="fa fa-minus"></i></a>
             <!-- /ko -->
           </div>
+          <!-- /ko -->
           <div class="search-bar-query-operations">
+            <!-- ko if: $root.collection.engine() !== 'report' -->
             <a class="btn" href="javascript:void(0)" data-bind="click: $root.query.addQ, css: { 'flat-left': $root.query.qs().length === 1}, style: { 'margin-left': $root.query.qs().length > 1 ? '10px' : '0' }, visible: ! collection.supportAnalytics()">
               <i class="fa fa-plus"></i>
             </a>
+            <!-- /ko -->
 
             <button type="submit" id="search-btn" class="btn btn-primary disable-feedback" style="margin-left:10px; margin-right:10px">
               <i class="fa fa-search" data-bind="visible: ! isRetrievingResults()"></i>
@@ -3956,12 +3960,17 @@ function loadSearch(collection, query, initial) {
     }
   ]);
 
-  searchViewModel.init(function(data){
+  searchViewModel.init(function(){
     $(".chosen-select").trigger("chosen:updated");
+    if (searchViewModel.collection.engine() === 'report') {
+      // TODO: remove forced table
+      searchViewModel.collection.name('default.web_logs');
+      textSearchLayout(searchViewModel, true);
+    }
   });
 
   searchViewModel.isRetrievingResults.subscribe(function(value){
-    if (! value){
+    if (!value){
       resizeFieldsList();
     }
   });

Some files were not shown because too many files changed in this diff