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
d5a56b0b
Commit
d5a56b0b
authored
Mar 22, 2019
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor refactoring of #16127
parent
c7c0ba5a
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
26 additions
and
25 deletions
+26
-25
packages/grafana-ui/src/types/data.ts
+14
-0
public/app/features/annotations/all.ts
+1
-3
public/app/features/annotations/event.ts
+0
-11
public/app/features/annotations/event_editor.ts
+1
-1
public/app/features/annotations/event_manager.ts
+8
-8
public/app/plugins/datasource/prometheus/datasource.ts
+2
-2
No files found.
packages/grafana-ui/src/types/data.ts
View file @
d5a56b0b
...
@@ -76,3 +76,17 @@ export interface TableData {
...
@@ -76,3 +76,17 @@ export interface TableData {
rows
:
any
[][];
rows
:
any
[][];
tags
?:
Tags
;
tags
?:
Tags
;
}
}
export
interface
AnnotationEvent
{
annotation
?:
any
;
dashboardId
?:
number
;
panelId
?:
number
;
userId
?:
number
;
time
?:
number
;
timeEnd
?:
number
;
isRegion
?:
boolean
;
title
?:
string
;
text
?:
string
;
type
?:
string
;
tags
?:
string
;
}
public/app/features/annotations/all.ts
View file @
d5a56b0b
import
{
AnnotationsSrv
}
from
'./annotations_srv'
;
import
{
AnnotationsSrv
}
from
'./annotations_srv'
;
import
{
eventEditor
}
from
'./event_editor'
;
import
{
eventEditor
}
from
'./event_editor'
;
import
{
EventManager
}
from
'./event_manager'
;
import
{
EventManager
}
from
'./event_manager'
;
import
{
AnnotationEvent
}
from
'./event'
;
import
{
annotationTooltipDirective
}
from
'./annotation_tooltip'
;
import
{
annotationTooltipDirective
}
from
'./annotation_tooltip'
;
export
{
AnnotationsSrv
,
eventEditor
,
EventManager
,
annotationTooltipDirective
};
export
{
AnnotationsSrv
,
eventEditor
,
EventManager
,
AnnotationEvent
,
annotationTooltipDirective
};
public/app/features/annotations/event.ts
deleted
100644 → 0
View file @
c7c0ba5a
export
class
AnnotationEvent
{
dashboardId
:
number
;
panelId
:
number
;
userId
:
number
;
time
:
any
;
timeEnd
:
any
;
isRegion
:
boolean
;
text
:
string
;
type
:
string
;
tags
:
string
;
}
public/app/features/annotations/event_editor.ts
View file @
d5a56b0b
...
@@ -2,7 +2,7 @@ import _ from 'lodash';
...
@@ -2,7 +2,7 @@ import _ from 'lodash';
import
moment
from
'moment'
;
import
moment
from
'moment'
;
import
{
coreModule
}
from
'app/core/core'
;
import
{
coreModule
}
from
'app/core/core'
;
import
{
MetricsPanelCtrl
}
from
'app/plugins/sdk'
;
import
{
MetricsPanelCtrl
}
from
'app/plugins/sdk'
;
import
{
AnnotationEvent
}
from
'
./event
'
;
import
{
AnnotationEvent
}
from
'
@grafana/ui
'
;
export
class
EventEditorCtrl
{
export
class
EventEditorCtrl
{
panelCtrl
:
MetricsPanelCtrl
;
panelCtrl
:
MetricsPanelCtrl
;
...
...
public/app/features/annotations/event_manager.ts
View file @
d5a56b0b
import
_
from
'lodash'
;
import
_
from
'lodash'
;
import
moment
from
'moment'
;
import
tinycolor
from
'tinycolor2'
;
import
tinycolor
from
'tinycolor2'
;
import
{
import
{
OK_COLOR
,
OK_COLOR
,
...
@@ -11,7 +10,7 @@ import {
...
@@ -11,7 +10,7 @@ import {
}
from
'@grafana/ui'
;
}
from
'@grafana/ui'
;
import
{
MetricsPanelCtrl
}
from
'app/plugins/sdk'
;
import
{
MetricsPanelCtrl
}
from
'app/plugins/sdk'
;
import
{
AnnotationEvent
}
from
'
./event
'
;
import
{
AnnotationEvent
}
from
'
@grafana/ui
'
;
export
class
EventManager
{
export
class
EventManager
{
event
:
AnnotationEvent
;
event
:
AnnotationEvent
;
...
@@ -31,16 +30,17 @@ export class EventManager {
...
@@ -31,16 +30,17 @@ export class EventManager {
updateTime
(
range
)
{
updateTime
(
range
)
{
if
(
!
this
.
event
)
{
if
(
!
this
.
event
)
{
this
.
event
=
new
AnnotationEvent
()
;
this
.
event
=
{}
;
this
.
event
.
dashboardId
=
this
.
panelCtrl
.
dashboard
.
id
;
this
.
event
.
dashboardId
=
this
.
panelCtrl
.
dashboard
.
id
;
this
.
event
.
panelId
=
this
.
panelCtrl
.
panel
.
id
;
this
.
event
.
panelId
=
this
.
panelCtrl
.
panel
.
id
;
}
}
// update time
// update time
this
.
event
.
time
=
moment
(
range
.
from
)
;
this
.
event
.
time
=
range
.
from
;
this
.
event
.
isRegion
=
false
;
this
.
event
.
isRegion
=
false
;
if
(
range
.
to
)
{
if
(
range
.
to
)
{
this
.
event
.
timeEnd
=
moment
(
range
.
to
)
;
this
.
event
.
timeEnd
=
range
.
to
;
this
.
event
.
isRegion
=
true
;
this
.
event
.
isRegion
=
true
;
}
}
...
@@ -90,8 +90,8 @@ export class EventManager {
...
@@ -90,8 +90,8 @@ export class EventManager {
annotations
=
[
annotations
=
[
{
{
isRegion
:
true
,
isRegion
:
true
,
min
:
this
.
event
.
time
.
valueOf
()
,
min
:
this
.
event
.
time
,
timeEnd
:
this
.
event
.
timeEnd
.
valueOf
()
,
timeEnd
:
this
.
event
.
timeEnd
,
text
:
this
.
event
.
text
,
text
:
this
.
event
.
text
,
eventType
:
'$__editing'
,
eventType
:
'$__editing'
,
editModel
:
this
.
event
,
editModel
:
this
.
event
,
...
@@ -100,7 +100,7 @@ export class EventManager {
...
@@ -100,7 +100,7 @@ export class EventManager {
}
else
{
}
else
{
annotations
=
[
annotations
=
[
{
{
min
:
this
.
event
.
time
.
valueOf
()
,
min
:
this
.
event
.
time
,
text
:
this
.
event
.
text
,
text
:
this
.
event
.
text
,
editModel
:
this
.
event
,
editModel
:
this
.
event
,
eventType
:
'$__editing'
,
eventType
:
'$__editing'
,
...
...
public/app/plugins/datasource/prometheus/datasource.ts
View file @
d5a56b0b
...
@@ -15,7 +15,7 @@ import { expandRecordingRules } from './language_utils';
...
@@ -15,7 +15,7 @@ import { expandRecordingRules } from './language_utils';
// Types
// Types
import
{
PromQuery
}
from
'./types'
;
import
{
PromQuery
}
from
'./types'
;
import
{
DataQueryOptions
,
DataSourceApi
}
from
'@grafana/ui/src/types'
;
import
{
DataQueryOptions
,
DataSourceApi
,
AnnotationEvent
}
from
'@grafana/ui/src/types'
;
import
{
ExploreUrlState
}
from
'app/types/explore'
;
import
{
ExploreUrlState
}
from
'app/types/explore'
;
export
class
PrometheusDatasource
implements
DataSourceApi
<
PromQuery
>
{
export
class
PrometheusDatasource
implements
DataSourceApi
<
PromQuery
>
{
...
@@ -359,7 +359,7 @@ export class PrometheusDatasource implements DataSourceApi<PromQuery> {
...
@@ -359,7 +359,7 @@ export class PrometheusDatasource implements DataSourceApi<PromQuery> {
for
(
const
value
of
series
.
values
)
{
for
(
const
value
of
series
.
values
)
{
const
valueIsTrue
=
value
[
1
]
===
'1'
;
// e.g. ALERTS
const
valueIsTrue
=
value
[
1
]
===
'1'
;
// e.g. ALERTS
if
(
valueIsTrue
||
annotation
.
useValueForTime
)
{
if
(
valueIsTrue
||
annotation
.
useValueForTime
)
{
const
event
:
any
=
{
const
event
:
AnnotationEvent
=
{
annotation
:
annotation
,
annotation
:
annotation
,
title
:
self
.
resultTransformer
.
renderTemplate
(
titleFormat
,
series
.
metric
),
title
:
self
.
resultTransformer
.
renderTemplate
(
titleFormat
,
series
.
metric
),
tags
:
tags
,
tags
:
tags
,
...
...
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