mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
added more keyboard shortcuts to open search, save and toggle controls
This commit is contained in:
parent
2be31e5779
commit
e7dd50eda5
@ -19,11 +19,12 @@
|
|||||||
|
|
||||||
define([
|
define([
|
||||||
'angular',
|
'angular',
|
||||||
|
'jquery',
|
||||||
'config',
|
'config',
|
||||||
'underscore',
|
'underscore',
|
||||||
'services/all'
|
'services/all'
|
||||||
],
|
],
|
||||||
function (angular, config, _) {
|
function (angular, $, config, _) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var module = angular.module('kibana.controllers');
|
var module = angular.module('kibana.controllers');
|
||||||
@ -60,6 +61,10 @@ function (angular, config, _) {
|
|||||||
|
|
||||||
$scope.ejs = ejsResource(config.elasticsearch);
|
$scope.ejs = ejsResource(config.elasticsearch);
|
||||||
|
|
||||||
|
$scope.bindKeyboardShortcuts();
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.bindKeyboardShortcuts = function() {
|
||||||
$rootScope.$on('panel-fullscreen-enter', function() {
|
$rootScope.$on('panel-fullscreen-enter', function() {
|
||||||
$scope.fullscreenPanelExists = true;
|
$scope.fullscreenPanelExists = true;
|
||||||
});
|
});
|
||||||
@ -68,9 +73,27 @@ function (angular, config, _) {
|
|||||||
$scope.fullscreenPanelExists = false;
|
$scope.fullscreenPanelExists = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
keyboardManager.bind('ctrl+f', function(evt) {
|
||||||
|
$rootScope.$emit('open-search', evt);
|
||||||
|
}, { inputDisabled: true });
|
||||||
|
|
||||||
|
keyboardManager.bind('ctrl+h', function(evt) {
|
||||||
|
var current = dashboard.current.hideControls;
|
||||||
|
dashboard.current.hideControls = !current;
|
||||||
|
dashboard.current.panel_hints = !current;
|
||||||
|
}, { inputDisabled: true });
|
||||||
|
|
||||||
|
keyboardManager.bind('ctrl+s', function(evt) {
|
||||||
|
$rootScope.$emit('save-dashboard', evt);
|
||||||
|
}, { inputDisabled: true });
|
||||||
|
|
||||||
keyboardManager.bind('esc', function() {
|
keyboardManager.bind('esc', function() {
|
||||||
|
var popups = $('.popover.in');
|
||||||
|
if (popups.length > 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
$rootScope.$emit('panel-fullscreen-exit');
|
$rootScope.$emit('panel-fullscreen-exit');
|
||||||
});
|
}, { inputDisabled: true });
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.countWatchers = function (scopeStart) {
|
$scope.countWatchers = function (scopeStart) {
|
||||||
|
@ -7,13 +7,17 @@ function (angular, _) {
|
|||||||
|
|
||||||
var module = angular.module('kibana.controllers');
|
var module = angular.module('kibana.controllers');
|
||||||
|
|
||||||
module.controller('dashLoader', function($scope, $http, timer, dashboard, alertSrv, $location) {
|
module.controller('dashLoader', function($scope, $rootScope, $http, timer, dashboard, alertSrv, $location) {
|
||||||
$scope.loader = dashboard.current.loader;
|
$scope.loader = dashboard.current.loader;
|
||||||
|
|
||||||
$scope.init = function() {
|
$scope.init = function() {
|
||||||
$scope.gist_pattern = /(^\d{5,}$)|(^[a-z0-9]{10,}$)|(gist.github.com(\/*.*)\/[a-z0-9]{5,}\/*$)/;
|
$scope.gist_pattern = /(^\d{5,}$)|(^[a-z0-9]{10,}$)|(gist.github.com(\/*.*)\/[a-z0-9]{5,}\/*$)/;
|
||||||
$scope.gist = $scope.gist || {};
|
$scope.gist = $scope.gist || {};
|
||||||
$scope.elasticsearch = $scope.elasticsearch || {};
|
$scope.elasticsearch = $scope.elasticsearch || {};
|
||||||
|
|
||||||
|
$rootScope.$on('save-dashboard', function() {
|
||||||
|
$scope.elasticsearch_save('dashboard', false);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.showDropdown = function(type) {
|
$scope.showDropdown = function(type) {
|
||||||
|
@ -9,24 +9,20 @@ function (angular, _, config, $) {
|
|||||||
|
|
||||||
var module = angular.module('kibana.controllers');
|
var module = angular.module('kibana.controllers');
|
||||||
|
|
||||||
module.controller('SearchCtrl', function($scope, dashboard, keyboardManager, $element, $location) {
|
module.controller('SearchCtrl', function($scope, $rootScope, dashboard, $element, $location) {
|
||||||
|
|
||||||
$scope.init = function() {
|
$scope.init = function() {
|
||||||
$scope.elasticsearch = $scope.elasticsearch || {};
|
$scope.elasticsearch = $scope.elasticsearch || {};
|
||||||
$scope.giveSearchFocus = 0;
|
$scope.giveSearchFocus = 0;
|
||||||
$scope.selectedIndex = -1;
|
$scope.selectedIndex = -1;
|
||||||
|
|
||||||
/*keyboardManager.bind('shift+s', function() {
|
$rootScope.$on('open-search', $scope.openSearch);
|
||||||
$element.find('.dropdown').addClass('open');
|
|
||||||
$scope.giveSearchFocus += 1;
|
|
||||||
});*/
|
|
||||||
|
|
||||||
keyboardManager.bind('esc', function() {
|
|
||||||
$element.find('.dropdown').removeClass('open');
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.keyDown = function (evt) {
|
$scope.keyDown = function (evt) {
|
||||||
|
if (evt.keyCode === 27) {
|
||||||
|
$element.find('.dropdown-toggle').dropdown('toggle');
|
||||||
|
}
|
||||||
if (evt.keyCode === 40) {
|
if (evt.keyCode === 40) {
|
||||||
$scope.selectedIndex++;
|
$scope.selectedIndex++;
|
||||||
}
|
}
|
||||||
@ -99,7 +95,11 @@ function (angular, _, config, $) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.openSearch = function () {
|
$scope.openSearch = function (evt) {
|
||||||
|
if (evt) {
|
||||||
|
$element.find('.dropdown-toggle').dropdown('toggle');
|
||||||
|
}
|
||||||
|
|
||||||
$scope.giveSearchFocus = $scope.giveSearchFocus + 1;
|
$scope.giveSearchFocus = $scope.giveSearchFocus + 1;
|
||||||
$scope.elasticsearch_dblist("");
|
$scope.elasticsearch_dblist("");
|
||||||
};
|
};
|
||||||
|
@ -50,7 +50,7 @@ function (angular) {
|
|||||||
'</span>'+
|
'</span>'+
|
||||||
'</span>' +
|
'</span>' +
|
||||||
|
|
||||||
'<span ng-if="panelMenuItems" class="dropdown" ng-show="panel.title">' +
|
'<span ng-if="panelMeta.menuItems" class="dropdown" ng-show="panel.title">' +
|
||||||
'<span class="pointer dropdown-toggle row-text row-button panel-title pointer" data-toggle="dropdown" tabindex="1">' +
|
'<span class="pointer dropdown-toggle row-text row-button panel-title pointer" data-toggle="dropdown" tabindex="1">' +
|
||||||
'{{panel.title}}' +
|
'{{panel.title}}' +
|
||||||
'</span>' +
|
'</span>' +
|
||||||
|
@ -37,14 +37,7 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
|
|||||||
module.controller('graphite', function($scope, $rootScope, filterSrv, graphiteSrv, $timeout) {
|
module.controller('graphite', function($scope, $rootScope, filterSrv, graphiteSrv, $timeout) {
|
||||||
|
|
||||||
$scope.panelMeta = {
|
$scope.panelMeta = {
|
||||||
modals : [
|
modals : [],
|
||||||
{
|
|
||||||
description: "Inspect",
|
|
||||||
icon: "icon-info-sign",
|
|
||||||
partial: "app/partials/inspector.html",
|
|
||||||
show: $scope.panel.spyable
|
|
||||||
}
|
|
||||||
],
|
|
||||||
editorTabs: [],
|
editorTabs: [],
|
||||||
|
|
||||||
fullEditorTabs : [
|
fullEditorTabs : [
|
||||||
@ -61,6 +54,13 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
|
|||||||
src:'app/panels/graphite/styleEditor.html'
|
src:'app/panels/graphite/styleEditor.html'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
|
menuItems: [
|
||||||
|
{ text: 'View fullscreen', action: $scope.toggleFullscreen },
|
||||||
|
{ text: 'Edit', action: $scope.openConfigureModal },
|
||||||
|
{ text: 'Duplicate', action: $scope.duplicate }
|
||||||
|
],
|
||||||
|
|
||||||
status : "Unstable",
|
status : "Unstable",
|
||||||
description : "Graphite graphing panel <br /><br />"
|
description : "Graphite graphing panel <br /><br />"
|
||||||
};
|
};
|
||||||
@ -419,11 +419,6 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
|
|||||||
$scope.enterFullscreenMode({edit: true});
|
$scope.enterFullscreenMode({edit: true});
|
||||||
};
|
};
|
||||||
|
|
||||||
// I really don't like this function, too much dom manip. Break out into directive?
|
|
||||||
$scope.populate_modal = function(request) {
|
|
||||||
$scope.inspector = angular.toJson(request,true);
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.set_refresh = function (state) {
|
$scope.set_refresh = function (state) {
|
||||||
$scope.refresh = state;
|
$scope.refresh = state;
|
||||||
};
|
};
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
ng-class="{'selected': $index === selectedIndex }">
|
ng-class="{'selected': $index === selectedIndex }">
|
||||||
<td><a ng-click="elasticsearch_delete(row._id)"><i class="icon-remove"></i></a></td>
|
<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 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>
|
<td><a><i class="icon-share" ng-click="share = dashboard.share_link(row._id,'elasticsearch',row._id)" bs-modal="'app/partials/dashLoaderShare.html'"></i></a></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
1
src/vendor/angular/angular-strap.js
vendored
1
src/vendor/angular/angular-strap.js
vendored
@ -546,6 +546,7 @@ angular.module('$strap.directives').directive('bsPopover', [
|
|||||||
$('body').on('keyup', function (ev) {
|
$('body').on('keyup', function (ev) {
|
||||||
if (ev.keyCode === 27) {
|
if (ev.keyCode === 27) {
|
||||||
$('.popover.in').each(function () {
|
$('.popover.in').each(function () {
|
||||||
|
debugger;
|
||||||
$(this).popover('hide');
|
$(this).popover('hide');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user