From 5472e5f940ac6eb02af1bb18dc871d4521f25151 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Sat, 28 Dec 2013 18:54:26 +0100 Subject: [PATCH] added dropdown menu for panel title, with view fullscreen, edit and duplicate panel options --- src/app/directives/kibanaPanel.js | 11 ++++++++++- src/app/panels/graphite/module.js | 25 ++++++++++++++++++++++--- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/src/app/directives/kibanaPanel.js b/src/app/directives/kibanaPanel.js index 7c371a0d683..27db676bc12 100644 --- a/src/app/directives/kibanaPanel.js +++ b/src/app/directives/kibanaPanel.js @@ -50,7 +50,16 @@ function (angular) { ''+ '' + - '' + + '' + + '' + + '{{panel.title}}' + + '' + + '' + + ''+ + + '' + '{{panel.title}}' + ''+ diff --git a/src/app/panels/graphite/module.js b/src/app/panels/graphite/module.js index 75374028059..8b63928bf35 100644 --- a/src/app/panels/graphite/module.js +++ b/src/app/panels/graphite/module.js @@ -212,6 +212,11 @@ function (angular, app, $, _, kbn, moment, timeSeries) { $scope.init = function() { //$scope.openConfigureModal(); + $scope.panelMenuItems = [ + { text: 'View fullscreen', action: $scope.toggleFullscreen }, + { text: 'Edit', action: $scope.openConfigureModal }, + { text: 'Duplicate', action: $scope.duplicate } + ]; // Hide view options by default $scope.options = false; @@ -439,7 +444,21 @@ function (angular, app, $, _, kbn, moment, timeSeries) { series.color = color; $scope.panel.aliasColors[series.alias] = series.color; $scope.render(); - } + }; + + $scope.duplicate = function() { + var panelCopy = angular.copy($scope.panel); + + var currentRowSpan = $scope.rowSpan($scope.row); + if (currentRowSpan <= 8) { + $scope.row.panels.push(panelCopy); + } + else { + var rowCopy = angular.copy($scope.row); + rowCopy.panels = [panelCopy]; + $scope.dashboard.current.rows.push(rowCopy); + } + }; $scope.toggleFullscreen = function(evt) { if ($scope.showFullscreen) { @@ -587,11 +606,11 @@ function (angular, app, $, _, kbn, moment, timeSeries) { }; if(scope.panel.y_format === 'bytes') { - options.yaxis.mode = "byte"; + options.yaxes[0].mode = "byte"; } if(scope.panel.y_format === 'short') { - options.yaxis.tickFormatter = function(val) { + options.yaxes[0].tickFormatter = function(val) { return kbn.shortFormat(val,0); }; }