Procházet zdrojové kódy

tweaks to new panel menu, now how top area of panel is clickable, and if no title a 5px high area can be clicked, this will enable panels without title which is something I have wanted

Torkel Ödegaard před 11 roky
rodič
revize
a08cb52ad9

+ 1 - 1
src/app/directives/grafanaPanel.js

@@ -26,7 +26,7 @@ function (angular, $) {
             '<i class="icon-spinner icon-spin icon-large"></i>' +
             '<i class="icon-spinner icon-spin icon-large"></i>' +
           '</span>' +
           '</span>' +
 
 
-          '<div panel-menu></div>' +
+          '<div class="panel-title-container" panel-menu></div>' +
         '</div>'+
         '</div>'+
       '</div>';
       '</div>';
 
 

+ 2 - 4
src/app/directives/panelMenu.js

@@ -9,7 +9,7 @@ function (angular, $, _) {
   angular
   angular
     .module('grafana.directives')
     .module('grafana.directives')
     .directive('panelMenu', function($compile) {
     .directive('panelMenu', function($compile) {
-      var linkTemplate = '<a class="pointer panel-title">{{panel.title || interpolateTemplateVars}}</a>';
+      var linkTemplate = '<a class="panel-title">{{panel.title || interpolateTemplateVars}}</a>';
       var moveAttributes = ' data-drag=true data-jqyoui-options="kbnJqUiDraggableOptions"'+
       var moveAttributes = ' data-drag=true data-jqyoui-options="kbnJqUiDraggableOptions"'+
               ' jqyoui-draggable="{'+
               ' jqyoui-draggable="{'+
                 'animate:false,'+
                 'animate:false,'+
@@ -62,8 +62,6 @@ function (angular, $, _) {
             clearTimeout(timeout);
             clearTimeout(timeout);
             timeout = null;
             timeout = null;
 
 
-            console.log('dismiss', time);
-
             if (time) {
             if (time) {
               timeout = setTimeout(dismiss, time);
               timeout = setTimeout(dismiss, time);
               return;
               return;
@@ -124,7 +122,7 @@ function (angular, $, _) {
             dismiss(2500);
             dismiss(2500);
           };
           };
 
 
-          $link.click(showMenu);
+          elem.click(showMenu);
           $compile(elem.contents())($scope);
           $compile(elem.contents())($scope);
         }
         }
       };
       };

+ 0 - 1
src/app/services/panelSrv.js

@@ -10,7 +10,6 @@ function (angular, _) {
 
 
     this.init = function($scope) {
     this.init = function($scope) {
       if (!$scope.panel.span) { $scope.panel.span = 12; }
       if (!$scope.panel.span) { $scope.panel.span = 12; }
-      if (!$scope.panel.title) { $scope.panel.title = 'No title'; }
 
 
       var menu = [
       var menu = [
         {
         {

+ 5 - 0
src/css/less/panel.less

@@ -15,6 +15,11 @@
   padding: 0px 10px 5px 10px;
   padding: 0px 10px 5px 10px;
 }
 }
 
 
+.panel-title-container {
+  min-height: 5px;
+  cursor: pointer;
+}
+
 .panel-title {
 .panel-title {
   border: 0px;
   border: 0px;
   font-weight: bold;
   font-weight: bold;