Commit 5472e5f9 by Torkel Ödegaard

added dropdown menu for panel title, with view fullscreen, edit and duplicate panel options

parent 433af083
......@@ -50,7 +50,16 @@ function (angular) {
'</span>'+
'</span>' +
'<span class="row-button row-text panel-title pointer" ng-show="panel.title" ng-click="toggleFullscreen()">' +
'<span ng-if="panelMenuItems" class="dropdown" ng-show="panel.title">' +
'<span class="pointer dropdown-toggle row-text row-button panel-title pointer" data-toggle="dropdown" tabindex="1">' +
'{{panel.title}}' +
'</span>' +
'<ul class="dropdown-menu" role="menu">' +
'<li ng-repeat="item in panelMenuItems"><a ng-click="item.action();">{{item.text}}</a></li>' +
'</ul>' +
'</span>'+
'<span ng-if="!panelMenuItems" class="row-button row-text panel-title pointer" ng-show="panel.title">' +
'{{panel.title}}' +
'</span>'+
......
......@@ -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);
};
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment