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
171c5aa5
Commit
171c5aa5
authored
Jul 13, 2014
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
began work on annotations redesign to easier support more annotation sources, #133, #394, #403
parent
b5d378c4
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
64 additions
and
29 deletions
+64
-29
src/app/panels/annotations/editor.html
+4
-16
src/app/panels/annotations/module.js
+8
-3
src/app/partials/graphite/annotation_editor.html
+15
-0
src/app/partials/influxdb/annotation_editor.html
+7
-0
src/app/services/datasourceSrv.js
+25
-10
src/app/services/graphite/graphiteDatasource.js
+2
-0
src/app/services/influxdb/influxdbDatasource.js
+3
-0
No files found.
src/app/panels/annotations/editor.html
View file @
171c5aa5
...
...
@@ -32,8 +32,8 @@
<input
type=
"text"
class=
"input-medium"
ng-model=
'currentAnnnotation.name'
placeholder=
"name"
></input>
</div>
<div
class=
"editor-option"
>
<label
class=
"small"
>
Typ
e
</label>
<select
ng-model=
"current
Annnotation.type"
ng-options=
"f for f in ['graphite metric', 'graphite events']
"
></select>
<label
class=
"small"
>
Datasourc
e
</label>
<select
ng-model=
"current
Datasource"
ng-options=
"f.name for f in datasources"
ng-change=
"setDatasource()
"
></select>
</div>
<div
class=
"editor-option"
>
<label
class=
"small"
>
Icon color
</label>
...
...
@@ -53,18 +53,7 @@
</div>
</div>
<div
class=
"editor-row"
ng-if=
"currentAnnnotation.type === 'graphite metric'"
>
<div
class=
"editor-option"
>
<label
class=
"small"
>
Graphite target expression
</label>
<input
type=
"text"
class=
"span10"
ng-model=
'currentAnnnotation.target'
placeholder=
""
></input>
</div>
</div>
<div
class=
"editor-row"
ng-if=
"currentAnnnotation.type === 'graphite events'"
>
<div
class=
"editor-option"
>
<label
class=
"small"
>
Graphite event tags
</label>
<input
type=
"text"
ng-model=
'currentAnnnotation.tags'
placeholder=
""
></input>
</div>
<div
ng-include
src=
"currentDatasource.editorSrc"
>
</div>
</div>
...
...
@@ -73,4 +62,4 @@
<button
ng-show=
"currentIsNew"
type=
"button"
class=
"btn btn-success"
ng-click=
"add()"
>
Add annotation
</button>
<button
ng-show=
"!currentIsNew"
type=
"button"
class=
"btn btn-success"
ng-click=
"update()"
>
Update
</button>
<button
type=
"button"
class=
"btn btn-danger"
ng-click=
"close_edit();dismiss();dashboard.refresh();"
>
Close
</button>
</div>
\ No newline at end of file
</div>
src/app/panels/annotations/module.js
View file @
171c5aa5
...
...
@@ -14,7 +14,7 @@ function (angular, app, _) {
var
module
=
angular
.
module
(
'kibana.panels.annotations'
,
[]);
app
.
useModule
(
module
);
module
.
controller
(
'AnnotationsCtrl'
,
function
(
$scope
,
da
shboard
,
$rootScope
)
{
module
.
controller
(
'AnnotationsCtrl'
,
function
(
$scope
,
da
tasourceSrv
,
$rootScope
)
{
$scope
.
panelMeta
=
{
status
:
"Stable"
,
...
...
@@ -41,14 +41,20 @@ function (angular, app, _) {
$scope
.
init
=
function
()
{
$scope
.
currentAnnnotation
=
angular
.
copy
(
annotationDefaults
);
$scope
.
currentIsNew
=
true
;
$scope
.
datasources
=
datasourceSrv
.
getAnnotationSources
();
if
(
$scope
.
datasources
.
length
>
0
)
{
$scope
.
currentDatasource
=
$scope
.
datasources
[
0
];
}
};
$scope
.
edit
=
function
(
annotation
)
{
$scope
.
currentAnnnotation
=
annotation
;
$scope
.
currentIsNew
=
false
;
$scope
.
currentDatasource
=
datasourceSrv
.
get
(
annotation
.
datasource
);
};
$scope
.
update
=
function
()
{
$scope
.
currentAnnotation
.
datasource
=
$scope
.
currentDatasource
.
name
;
$scope
.
currentAnnnotation
=
angular
.
copy
(
annotationDefaults
);
$scope
.
currentIsNew
=
true
;
};
...
...
@@ -64,4 +70,4 @@ function (angular, app, _) {
};
});
});
\ No newline at end of file
});
src/app/partials/graphite/annotation_editor.html
0 → 100644
View file @
171c5aa5
<div
class=
"editor-row"
>
<div
class=
"editor-option"
>
<label
class=
"small"
>
Graphite target expression
</label>
<input
type=
"text"
class=
"span10"
ng-model=
'currentAnnnotation.target'
placeholder=
""
></input>
</div>
</div>
<div
class=
"editor-row"
>
<div
class=
"editor-option"
>
<label
class=
"small"
>
Graphite event tags
</label>
<input
type=
"text"
ng-model=
'currentAnnnotation.tags'
placeholder=
""
></input>
</div>
</div>
src/app/partials/influxdb/annotation_editor.html
0 → 100644
View file @
171c5aa5
<div
class=
"editor-row"
>
<div
class=
"editor-option"
>
<label
class=
"small"
>
InfluxDB query
</label>
<input
type=
"text"
class=
"span10"
ng-model=
'currentAnnnotation.query'
placeholder=
""
></input>
</div>
</div>
src/app/services/datasourceSrv.js
View file @
171c5aa5
...
...
@@ -12,13 +12,19 @@ function (angular, _, config) {
var
module
=
angular
.
module
(
'kibana.services'
);
module
.
service
(
'datasourceSrv'
,
function
(
$q
,
filterSrv
,
$http
,
GraphiteDatasource
,
InfluxDatasource
,
OpenTSDBDatasource
)
{
var
datasources
=
{};
this
.
init
=
function
()
{
var
defaultDatasource
=
_
.
findWhere
(
_
.
values
(
config
.
datasources
),
{
default
:
true
});
if
(
!
defaultDatasource
)
{
defaultDatasource
=
config
.
datasources
[
_
.
keys
(
config
.
datasources
)[
0
]];
_
.
each
(
config
.
datasources
,
function
(
value
,
key
)
{
datasources
[
key
]
=
this
.
datasourceFactory
(
value
);
if
(
value
.
default
)
{
this
.
default
=
datasources
[
key
];
}
},
this
);
if
(
!
this
.
default
)
{
this
.
default
=
datasources
[
_
.
keys
(
datasources
)[
0
]];
}
this
.
default
=
this
.
datasourceFactory
(
defaultDatasource
);
};
this
.
datasourceFactory
=
function
(
ds
)
{
...
...
@@ -34,15 +40,24 @@ function (angular, _, config) {
this
.
get
=
function
(
name
)
{
if
(
!
name
)
{
return
this
.
default
;
}
if
(
datasources
[
name
])
{
return
datasources
[
name
];
}
var
ds
=
config
.
datasources
[
name
];
if
(
!
ds
)
{
return
null
;
}
return
this
.
datasourceFactory
(
ds
);
throw
"Unable to find datasource: "
+
name
;
};
this
.
getAnnotationSources
=
function
()
{
var
results
=
[];
_
.
each
(
datasources
,
function
(
value
,
key
)
{
if
(
value
.
supportAnnotations
)
{
results
.
push
({
name
:
key
,
editorSrc
:
value
.
annotationEditorSrc
});
}
});
return
results
;
};
this
.
listOptions
=
function
()
{
return
_
.
map
(
config
.
datasources
,
function
(
value
,
key
)
{
return
{
...
...
src/app/services/graphite/graphiteDatasource.js
View file @
171c5aa5
...
...
@@ -20,6 +20,8 @@ function (angular, _, $, config, kbn, moment) {
this
.
editorSrc
=
'app/partials/graphite/editor.html'
;
this
.
name
=
datasource
.
name
;
this
.
render_method
=
datasource
.
render_method
||
'POST'
;
this
.
supportAnnotations
=
true
;
this
.
annotationEditorSrc
=
'app/partials/graphite/annotation_editor.html'
;
}
GraphiteDatasource
.
prototype
.
query
=
function
(
filterSrv
,
options
)
{
...
...
src/app/services/influxdb/influxdbDatasource.js
View file @
171c5aa5
...
...
@@ -21,6 +21,9 @@ function (angular, _, kbn, InfluxSeries) {
this
.
templateSettings
=
{
interpolate
:
/
\[\[([\s\S]
+
?)\]\]
/g
,
};
this
.
supportAnnotations
=
true
;
this
.
annotationEditorSrc
=
'app/partials/influxdb/annotation_editor.html'
;
}
InfluxDatasource
.
prototype
.
query
=
function
(
filterSrv
,
options
)
{
...
...
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