瀏覽代碼

HUE-8255 [dashboard] Remove query builder mode Gridster limitations

Enrico Berti 7 年之前
父節點
當前提交
113aafc169

+ 6 - 6
desktop/core/src/desktop/templates/common_dashboard.mako

@@ -117,7 +117,7 @@
   </div>
 
   <!-- ko if: $root.isGridster -->
-  <div class="initial-hint empty-dashboard-plus" data-bind="fadeVisible: columns().length > 0 && showPlusButtonHint() && !$root.isQueryBuilder()">
+  <div class="initial-hint empty-dashboard-plus" data-bind="fadeVisible: columns().length > 0 && showPlusButtonHint()">
     <div style="float:left; padding-top: 120px; margin-right: -30px; text-align: center; width: 280px">${_('Drag the top plus button or any field from the right assistant into your dashboard')}</div>
     <img src="${ static('desktop/art/hint_arrow.svg') }" alt="${ _('Hint arrow') }" style="width: 90px" />
     <img src="${ static('desktop/art/hint_arrow.svg') }" alt="${ _('Hint arrow') }" style="width: 90px; margin-left: 80px; position: absolute; transform: rotate(33deg);" />
@@ -180,7 +180,7 @@
 <div data-bind="css: {'dashboard': true, 'with-top-margin': isEditing()}">
   <div class="container-fluid">
   <!-- ko if: $root.isGridster -->
-    <div class="gridster" data-bind="style: { 'opacity': $root.showPlusButtonHint() && !$root.isQueryBuilder() ? '.3' : '1' }">
+    <div class="gridster" data-bind="style: { 'opacity': $root.showPlusButtonHint() ? '.3' : '1' }">
       <!-- ko if: typeof gridItems !== 'undefined' -->
       <ul class="unstyled" data-bind="css: { 'is-adding': $root.isToolbarVisible }, gridster: { items: gridItems, template: 'widget-template-gridster${ suffix }' }"></ul>
       <!-- /ko -->
@@ -211,10 +211,10 @@
 <script id="widget-template-gridster${ suffix }" type="text/html">
   <li>
     <!-- ko ifnot: widget -->
-    <div class="empty-gridster-widget card card-widget" data-bind="draggable: { data: $data, isEnabled: $root.isGridster() && !$root.isQueryBuilder(), options: getDraggableOptions({ data: $data, parent: $data }) }">
+    <div class="empty-gridster-widget card card-widget" data-bind="draggable: { data: $data, isEnabled: $root.isGridster(), options: getDraggableOptions({ data: $data, parent: $data }) }">
       <h2 class="card-heading simple" title="${ _('Drag to move') }">
         ${ _('Empty widget') }
-        <div class="inline pull-right margin-right-10" data-bind="visible: !$root.isQueryBuilder()">
+        <div class="inline pull-right margin-right-10">
           <a href="javascript:void(0)" class="remove-widget" data-bind="publish: { 'gridster.remove': $data }"><i class="fa fa-times"></i></a>
         </div>
       </h2>
@@ -302,7 +302,7 @@
 </script>
 
 <script type="text/html" id="widget-template${ suffix }">
-  <div data-bind="attr: {'id': 'wdg_'+ id(),}, css: klass, draggable: { data: $data, isEnabled: $root.isGridster() && !$root.isQueryBuilder(), options: getDraggableOptions({ data: $data, parent: $parent }) }, droppable: { data: function() { $root.collection.dropOnWidget(id()) }, options:{ greedy:true, drop: function(event, ui) { huePubSub.publish('dashboard.drop.on.page', { event: event, ui: ui } } }}">
+  <div data-bind="attr: {'id': 'wdg_'+ id(),}, css: klass, draggable: { data: $data, isEnabled: $root.isGridster(), options: getDraggableOptions({ data: $data, parent: $parent }) }, droppable: { data: function() { $root.collection.dropOnWidget(id()) }, options:{ greedy:true, drop: function(event, ui) { huePubSub.publish('dashboard.drop.on.page', { event: event, ui: ui } } }}">
     <h2 class="card-heading simple" data-bind="attr: { title: $root.isGridster() ? '${ _ko('Drag to move') }' : '' }">
       <!-- ko ifnot: $root.isGridster -->
       <span data-bind="visible: $root.isEditing">
@@ -320,7 +320,7 @@
       <!-- ko if: typeof $root.collection == 'undefined' || $root.collection.getFacetById(id()) == null -->
         <span data-bind="editable: name, editableOptions: { enabled: true, placement: 'right' }" title="${ _('Click to change the widget title') }"></span>
       <!-- /ko -->
-      <div class="inline pull-right margin-right-10" data-bind="visible: !$root.isQueryBuilder()">
+      <div class="inline pull-right margin-right-10">
         <a href="javascript:void(0)" class="remove-widget" data-bind="click: $root.removeWidget"><i class="fa fa-times"></i></a>
       </div>
     </h2>

+ 0 - 2
desktop/libs/dashboard/src/dashboard/static/dashboard/js/search.ko.js

@@ -25,7 +25,6 @@ function queryBuilderSearchLayout(vm, isQueryBuilder) {
   loadSearchLayout(vm, vm.initial.qbLayout);
   $(document).trigger("magicSearchLayout");
   huePubSub.publish('dashboard.set.layout');
-  huePubSub.publish('right.assist.show', true);
 }
 
 function textSearchLayout(vm, isQueryBuilder) {
@@ -33,7 +32,6 @@ function textSearchLayout(vm, isQueryBuilder) {
   loadSearchLayout(vm, vm.initial.textSearchLayout);
   $(document).trigger("magicSearchLayout");
   huePubSub.publish('dashboard.set.layout');
-  huePubSub.publish('right.assist.hide', true);
 }
 
 function loadSearchLayout(viewModel, json_layout) {

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

@@ -132,7 +132,7 @@ from dashboard.conf import USE_GRIDSTER, HAS_REPORT_ENABLED, HAS_WIDGET_FILTER,
     </div>
 
     <div class="search-bar-operations">
-      <!-- ko if: $root.isGridster() && !$root.isQueryBuilder() -->
+      <!-- ko if: $root.isGridster() -->
       <div class="btn-group">
         <a class="btn draggable-plus-button move-cursor" title="${ _('Drag to add a widget') }" rel="tooltip" data-placement="bottom" data-bind="draggable: {data: $root.collection.supportAnalytics() ? draggableBucket() : draggableBar(), options: getDraggableOptions({ data: $root.collection.supportAnalytics() ? draggableBucket() : draggableBar(), plusButton: true })}, visible: columns().length, click: function() { isToolbarVisible(!isToolbarVisible()) }, css: {'btn': true, 'btn-inverse': isToolbarVisible }">
           <i class="fa fa-plus"></i>
@@ -4268,21 +4268,17 @@ $(document).ready(function () {
   }, 'dashboard');
 
   huePubSub.subscribe('dashboard.widget.drag', function (options) {
-    if (!searchViewModel.isQueryBuilder()) {
-      movePreviewHolder(options);
-    }
+    movePreviewHolder(options);
   }, 'dashboard');
 
   huePubSub.subscribe('draggable.text.drag', function (options) {
-    if (searchViewModel.isGridster() && !searchViewModel.isQueryBuilder()) {
+    if (searchViewModel.isGridster()) {
       movePreviewHolder(options);
     }
   }, 'dashboard');
 
   huePubSub.subscribe('dashboard.gridster.widget.drag', function (options) {
-    if (!searchViewModel.isQueryBuilder()) {
-      movePreviewHolder(options);
-    }
+    movePreviewHolder(options);
   }, 'dashboard');
 
   huePubSub.subscribe('draggable.text.meta', function (options) {
@@ -4297,9 +4293,6 @@ $(document).ready(function () {
 
   huePubSub.subscribeOnce('gridster.added.widget', function () {
     $(window).trigger('resize');
-    if (searchViewModel.isQueryBuilder()) {
-      $gridster.disable_resize();
-    }
   });
 
   huePubSub.subscribe('gridster.added.widget', removePreviewHolder, 'dashboard');
@@ -4795,7 +4788,7 @@ $(document).ready(function () {
   $('#searchComponents .dashboard').droppable({
     accept: '.draggable-widget, .draggableText, .card-widget, .draggable-plus-button',
     drop: function( event, ui ) {
-      if (searchViewModel.isGridster() && !searchViewModel.isQueryBuilder()) {
+      if (searchViewModel.isGridster()) {
         huePubSub.publish('dashboard.drop.on.page', {event: event, ui: ui});
       }
     }