Răsfoiți Sursa

HUE-7610 [dashboard] Add delete functionality to an empty widget

Enrico Berti 8 ani în urmă
părinte
comite
17700bca96

Fișier diff suprimat deoarece este prea mare
+ 0 - 0
desktop/core/src/desktop/static/desktop/css/hue.css


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
desktop/core/src/desktop/static/desktop/css/hue3-extra.css


+ 5 - 0
desktop/core/src/desktop/static/desktop/less/components/hue-gridster.less

@@ -34,4 +34,9 @@
     border-radius: 0 !important;
     background: @cui-gray-200 !important;
   }
+  .remove-empty-gridster {
+    font-size: 12px;
+    margin-right: 3px;
+    margin-top: 2px;
+  }
 }

+ 5 - 0
desktop/core/src/desktop/templates/common_dashboard.mako

@@ -204,6 +204,11 @@
 
 <script id="widget-template-gridster${ suffix }" type="text/html">
   <li>
+    <!-- ko ifnot: widget -->
+    <div class="inline pull-right remove-empty-gridster" data-bind="visible: $root.isEditing">
+      <a href="javascript:void(0)" data-bind="click: function(data, e){ huePubSub.publish('gridster.remove', e.target); }"><i class="fa fa-times"></i></a>
+    </div>
+    <!-- /ko -->
     <!-- ko with: widget -->
     <span data-bind="template: 'widget-template${ suffix }'"></span>
     <div class="clearfix"></div>

+ 7 - 2
desktop/libs/dashboard/src/dashboard/templates/common_search.mako

@@ -3665,10 +3665,15 @@ $(document).ready(function () {
     resizeGridsterWidget($(element).parents('li.gs-w'));
   }, 'dashboard');
 
-  huePubSub.subscribe('gridster.remove.widget', function (widgetId) {
-    $(".gridster>ul").data('gridster').remove_widget($("#wdg_" + widgetId).parents('li.gs-w'));
+  huePubSub.subscribe('gridster.remove', function (element) {
+    $(".gridster>ul").data('gridster').remove_widget($(element).parents('li.gs-w'));
   }, 'dashboard')
 
+  huePubSub.subscribe('gridster.remove.widget', function (widgetId) {
+    huePubSub.publish('gridster.remove', "#wdg_" + widgetId);
+  }, 'dashboard');
+
+
   huePubSub.subscribe('gridster.add.widget', function (widgetId){
     var newPosition = $('.gridster ul').data('gridster').next_position(12, 12);
     searchViewModel.gridItems.push(ko.mapping.fromJS({

Unele fișiere nu au fost afișate deoarece prea multe fișiere au fost modificate în acest diff