Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
232513bb
Commit
232513bb
authored
Apr 12, 2017
by
Alexander Zobnin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
graph(add annotation): refactor
pass ctrlKey and metaKey through flot events
parent
f42202e6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
21 deletions
+14
-21
public/app/plugins/panel/graph/graph.ts
+4
-19
public/vendor/flot/jquery.flot.js
+4
-0
public/vendor/flot/jquery.flot.selection.js
+6
-2
No files found.
public/app/plugins/panel/graph/graph.ts
View file @
232513bb
...
...
@@ -84,7 +84,8 @@ coreModule.directive('grafanaGraph', function($rootScope, timeSrv) {
let
thisPanelEvent
=
event
.
panel
.
id
===
ctrl
.
panel
.
id
;
// Select time for new annotation
if
(
ctrl
.
inAddAnnotationMode
&&
thisPanelEvent
)
{
let
createAnnotation
=
ctrl
.
inAddAnnotationMode
||
event
.
pos
.
ctrlKey
||
event
.
pos
.
metaKey
;
if
(
createAnnotation
&&
thisPanelEvent
)
{
let
timeRange
=
{
from
:
event
.
pos
.
x
,
to
:
null
...
...
@@ -95,22 +96,6 @@ coreModule.directive('grafanaGraph', function($rootScope, timeSrv) {
}
},
scope
);
// Add keybinding for Add Annotation mode
$
(
document
).
keydown
(
onCtrlKeyDown
);
$
(
document
).
keyup
(
onCtrlKeyUp
);
function
onCtrlKeyDown
(
event
)
{
if
(
event
.
key
===
'Control'
)
{
ctrl
.
inAddAnnotationMode
=
true
;
}
}
function
onCtrlKeyUp
(
event
)
{
if
(
event
.
key
===
'Control'
)
{
ctrl
.
inAddAnnotationMode
=
false
;
}
}
function
getLegendHeight
(
panelHeight
)
{
if
(
!
panel
.
legend
.
show
||
panel
.
legend
.
rightSide
)
{
return
0
;
...
...
@@ -671,8 +656,8 @@ coreModule.directive('grafanaGraph', function($rootScope, timeSrv) {
}
elem
.
bind
(
"plotselected"
,
function
(
event
,
ranges
)
{
if
(
ctrl
.
inAddAnnotationMode
)
{
//
Select time range for new annotation
if
(
ctrl
.
inAddAnnotationMode
||
ranges
.
ctrlKey
||
ranges
.
metaKey
)
{
//
Create new annotation from time range
let
timeRange
=
ranges
.
xaxis
;
ctrl
.
showAddAnnotationModal
(
timeRange
);
plot
.
clearSelection
();
...
...
public/vendor/flot/jquery.flot.js
View file @
232513bb
...
...
@@ -2972,6 +2972,10 @@ Licensed under the MIT license.
pos
.
pageX
=
event
.
pageX
;
pos
.
pageY
=
event
.
pageY
;
// Add ctrlKey and metaKey to event
pos
.
ctrlKey
=
event
.
ctrlKey
;
pos
.
metaKey
=
event
.
metaKey
;
var
item
=
findNearbyItem
(
canvasX
,
canvasY
,
seriesFilter
);
if
(
item
)
{
...
...
public/vendor/flot/jquery.flot.selection.js
View file @
232513bb
...
...
@@ -145,7 +145,7 @@ The plugin allso adds the following methods to the plot object:
updateSelection
(
e
);
if
(
selectionIsSane
())
triggerSelectedEvent
();
triggerSelectedEvent
(
e
);
else
{
// this counts as a clear
plot
.
getPlaceholder
().
trigger
(
"plotunselected"
,
[
]);
...
...
@@ -180,9 +180,13 @@ The plugin allso adds the following methods to the plot object:
return
r
;
}
function
triggerSelectedEvent
()
{
function
triggerSelectedEvent
(
event
)
{
var
r
=
getSelection
();
// Add ctrlKey and metaKey to event
r
.
ctrlKey
=
event
.
ctrlKey
;
r
.
metaKey
=
event
.
metaKey
;
plot
.
getPlaceholder
().
trigger
(
"plotselected"
,
[
r
]);
// backwards-compat stuff, to be removed in future
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment