mirror of
https://github.com/grafana/grafana.git
synced 2025-02-12 00:25:46 -06:00
worked on dashboard search and keyboard nav, improved duplicate panel
This commit is contained in:
parent
5472e5f940
commit
2be31e5779
@ -73,6 +73,23 @@ function (angular, config, _) {
|
||||
});
|
||||
};
|
||||
|
||||
$scope.countWatchers = function (scopeStart) {
|
||||
var q = [scopeStart || $rootScope], watchers = 0, scope;
|
||||
while (q.length > 0) {
|
||||
scope = q.pop();
|
||||
if (scope.$$watchers) {
|
||||
watchers += scope.$$watchers.length;
|
||||
}
|
||||
if (scope.$$childHead) {
|
||||
q.push(scope.$$childHead);
|
||||
}
|
||||
if (scope.$$nextSibling) {
|
||||
q.push(scope.$$nextSibling);
|
||||
}
|
||||
}
|
||||
window.console.log(watchers);
|
||||
};
|
||||
|
||||
$scope.isPanel = function(obj) {
|
||||
if(!_.isNull(obj) && !_.isUndefined(obj) && !_.isUndefined(obj.type)) {
|
||||
return true;
|
||||
|
@ -71,6 +71,10 @@ function (angular, _) {
|
||||
};
|
||||
|
||||
$scope.elasticsearch_delete = function(id) {
|
||||
if (!confirm('Are you sure you want to delete dashboard?')) {
|
||||
return;
|
||||
}
|
||||
|
||||
dashboard.elasticsearch_delete(id).then(
|
||||
function(result) {
|
||||
if(!_.isUndefined(result)) {
|
||||
|
@ -9,12 +9,12 @@ function (angular, _, config, $) {
|
||||
|
||||
var module = angular.module('kibana.controllers');
|
||||
|
||||
module.controller('SearchCtrl', function($scope, dashboard, keyboardManager, $element) {
|
||||
module.controller('SearchCtrl', function($scope, dashboard, keyboardManager, $element, $location) {
|
||||
|
||||
$scope.init = function() {
|
||||
$scope.elasticsearch = $scope.elasticsearch || {};
|
||||
$scope.giveSearchFocus = 0;
|
||||
$scope.selectedIndex = null;
|
||||
$scope.selectedIndex = -1;
|
||||
|
||||
/*keyboardManager.bind('shift+s', function() {
|
||||
$element.find('.dropdown').addClass('open');
|
||||
@ -28,7 +28,19 @@ function (angular, _, config, $) {
|
||||
|
||||
$scope.keyDown = function (evt) {
|
||||
if (evt.keyCode === 40) {
|
||||
$scope.selectedIndex = ($scope.selectedIndex || 0) + 1;
|
||||
$scope.selectedIndex++;
|
||||
}
|
||||
if (evt.keyCode === 38) {
|
||||
$scope.selectedIndex--;
|
||||
}
|
||||
if (evt.keyCode === 13) {
|
||||
var selectedDash = $scope.search_results.dashboards[$scope.selectedIndex];
|
||||
if (selectedDash) {
|
||||
$location.path("/dashboard/elasticsearch/" + encodeURIComponent(selectedDash._id));
|
||||
setTimeout(function(){
|
||||
$('body').click(); // hack to force dropdown to close;
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -51,6 +63,7 @@ function (angular, _, config, $) {
|
||||
|
||||
$scope.elasticsearch_dblist = function(queryStr) {
|
||||
$scope.showImport = false;
|
||||
$scope.selectedIndex = -1;
|
||||
|
||||
queryStr = queryStr.toLowerCase();
|
||||
|
||||
|
@ -211,7 +211,7 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
|
||||
|
||||
|
||||
$scope.init = function() {
|
||||
//$scope.openConfigureModal();
|
||||
|
||||
$scope.panelMenuItems = [
|
||||
{ text: 'View fullscreen', action: $scope.toggleFullscreen },
|
||||
{ text: 'Edit', action: $scope.openConfigureModal },
|
||||
@ -446,17 +446,23 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
|
||||
$scope.render();
|
||||
};
|
||||
|
||||
$scope.duplicate = function() {
|
||||
var panelCopy = angular.copy($scope.panel);
|
||||
|
||||
var currentRowSpan = $scope.rowSpan($scope.row);
|
||||
$scope.duplicate = function(addToRow) {
|
||||
addToRow = addToRow || $scope.row;
|
||||
var currentRowSpan = $scope.rowSpan(addToRow);
|
||||
if (currentRowSpan <= 8) {
|
||||
$scope.row.panels.push(panelCopy);
|
||||
addToRow.panels.push(angular.copy($scope.panel));
|
||||
}
|
||||
else {
|
||||
var rowCopy = angular.copy($scope.row);
|
||||
rowCopy.panels = [panelCopy];
|
||||
$scope.dashboard.current.rows.push(rowCopy);
|
||||
var rowsList = $scope.dashboard.current.rows;
|
||||
var rowIndex = _.indexOf(rowsList, addToRow);
|
||||
if (rowIndex === rowsList.length - 1) {
|
||||
var newRow = angular.copy($scope.row);
|
||||
newRow.panels = [];
|
||||
$scope.duplicate(newRow);
|
||||
}
|
||||
else {
|
||||
$scope.duplicate(rowsList[rowIndex+1]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -27,7 +27,9 @@
|
||||
ng-change="elasticsearch_dblist(elasticsearch.query)" />
|
||||
<h6 ng-hide="search_results.dashboards.length || search_results.metrics.length">No dashboards or metrics matching your query found</h6>
|
||||
<table class="table table-condensed table-striped">
|
||||
<tr bindonce ng-repeat="row in search_results.metrics" class="grafana-search-metric-result">
|
||||
<tr bindonce ng-repeat="row in search_results.metrics"
|
||||
class="grafana-search-metric-result"
|
||||
ng-class="{'selected': $index === selectedIndex }">
|
||||
<td><span class="label label-info">metric</span></td>
|
||||
<td class="grafana-search-metric-name">
|
||||
{{row._id}}
|
||||
@ -39,7 +41,9 @@
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr bindonce ng-repeat="row in search_results.dashboards | orderBy:['_id']">
|
||||
<tr bindonce
|
||||
ng-repeat="row in search_results.dashboards"
|
||||
ng-class="{'selected': $index === selectedIndex }">
|
||||
<td><a ng-click="elasticsearch_delete(row._id)"><i class="icon-remove"></i></a></td>
|
||||
<td style="width:100%"><a href="#/dashboard/elasticsearch/{{row._id}}" bo-text="row._id"></a></td>
|
||||
<td><a><i class="icon-share" ng-click="share = dashboard.share_link(row._id,'elasticsearch',row._id)" bs-modal="'app/panels/dashcontrol/share.html'"></i></a></td>
|
||||
|
2
src/css/bootstrap.dark.min.css
vendored
2
src/css/bootstrap.dark.min.css
vendored
File diff suppressed because one or more lines are too long
9
src/vendor/bootstrap/less/grafana.less
vendored
9
src/vendor/bootstrap/less/grafana.less
vendored
@ -12,6 +12,15 @@
|
||||
.box-sizing(border-box);
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
.selected td, tr.selected:nth-child(odd)>td {
|
||||
background: darken(@blue, 20%);
|
||||
color: white;
|
||||
text-shadow: -1px -1px 1px rgba(0,0,0,0.3);
|
||||
a {
|
||||
color: white;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.panelCont {
|
||||
|
Loading…
Reference in New Issue
Block a user