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
8699d49f
Commit
8699d49f
authored
Jan 14, 2016
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(plugins): updated cloudwatch to new plugin style
parent
c4ce3293
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
43 additions
and
49 deletions
+43
-49
public/app/core/services/dynamic_directive_srv.ts
+9
-2
public/app/features/annotations/editor_ctrl.js
+4
-5
public/app/features/panel/query_editor.ts
+1
-9
public/app/plugins/datasource/cloudwatch/datasource.js
+0
-1
public/app/plugins/datasource/cloudwatch/module.js
+7
-20
public/app/plugins/datasource/cloudwatch/partials/annotations.editor.html
+1
-1
public/app/plugins/datasource/cloudwatch/partials/query.editor.html
+1
-1
public/app/plugins/datasource/cloudwatch/query_parameter_ctrl.js
+13
-3
public/app/plugins/datasource/elasticsearch/partials/annotations.editor.html
+7
-7
No files found.
public/app/core/services/dynamic_directive_srv.ts
View file @
8699d49f
...
...
@@ -28,7 +28,7 @@ class DynamicDirectiveSrv {
directiveInfo
.
fn
.
registered
=
true
;
}
this
.
addDirective
(
elem
,
directiveInfo
.
name
,
directiveInfo
.
scope
||
scope
);
this
.
addDirective
(
elem
,
directiveInfo
.
name
,
scope
);
}).
catch
(
err
=>
{
console
.
log
(
'Plugin load:'
,
err
);
this
.
$rootScope
.
appEvent
(
'alert-error'
,
[
'Plugin error'
,
err
.
toString
()]);
...
...
@@ -41,7 +41,14 @@ class DynamicDirectiveSrv {
scope
:
options
.
scope
,
link
:
(
scope
,
elem
,
attrs
)
=>
{
if
(
options
.
watch
)
{
scope
.
$watch
(
options
.
watch
,()
=>
this
.
link
(
scope
,
elem
,
attrs
,
options
));
let
childScope
=
null
;
scope
.
$watch
(
options
.
watch
,
()
=>
{
if
(
childScope
)
{
childScope
.
$destroy
();
}
childScope
=
scope
.
$new
();
this
.
link
(
childScope
,
elem
,
attrs
,
options
);
});
}
else
{
this
.
link
(
scope
,
elem
,
attrs
,
options
);
}
...
...
public/app/features/annotations/editor_ctrl.js
View file @
8699d49f
...
...
@@ -31,10 +31,10 @@ function (angular, _, $) {
};
$scope
.
datasourceChanged
=
function
()
{
$scope
.
currentDatasource
=
_
.
findWhere
(
$scope
.
datasources
,
{
name
:
$scope
.
currentAnnotation
.
datasource
});
if
(
!
$scope
.
currentDatasource
)
{
$scope
.
current
Datasource
=
$scope
.
datasources
[
0
]
;
}
datasourceSrv
.
get
(
$scope
.
currentAnnotation
.
datasource
).
then
(
function
(
ds
)
{
$scope
.
currentDatasource
=
ds
;
$scope
.
current
Annotation
.
datasource
=
ds
.
name
;
}
);
};
$scope
.
edit
=
function
(
annotation
)
{
...
...
@@ -50,7 +50,6 @@ function (angular, _, $) {
$scope
.
currentAnnotation
=
angular
.
copy
(
annotationDefaults
);
$scope
.
currentIsNew
=
true
;
$scope
.
datasourceChanged
();
$scope
.
currentAnnotation
.
datasource
=
$scope
.
currentDatasource
.
name
;
};
$scope
.
update
=
function
()
{
...
...
public/app/features/panel/query_editor.ts
View file @
8699d49f
...
...
@@ -8,21 +8,13 @@ function metricsQueryEditor(dynamicDirectiveSrv, datasourceSrv) {
watch
:
"panel.datasource"
,
directive
:
scope
=>
{
let
datasource
=
scope
.
target
.
datasource
||
scope
.
panel
.
datasource
;
let
editorScope
=
null
;
return
datasourceSrv
.
get
(
datasource
).
then
(
ds
=>
{
if
(
editorScope
)
{
editorScope
.
$destroy
();
}
editorScope
=
scope
.
$new
();
editorScope
.
datasource
=
ds
;
scope
.
datasource
=
ds
;
return
System
.
import
(
ds
.
meta
.
module
).
then
(
dsModule
=>
{
return
{
name
:
'metrics-query-editor-'
+
ds
.
meta
.
id
,
fn
:
dsModule
.
metricsQueryEditor
,
scope
:
editorScope
,
};
});
});
...
...
public/app/plugins/datasource/cloudwatch/datasource.js
View file @
8699d49f
...
...
@@ -3,7 +3,6 @@ define([
'lodash'
,
'moment'
,
'app/core/utils/datemath'
,
'./query_ctrl'
,
],
function
(
angular
,
_
,
moment
,
dateMath
)
{
'use strict'
;
...
...
public/app/plugins/datasource/cloudwatch/module.js
View file @
8699d49f
define
([
'angular'
,
'./datasource'
,
'./query_parameter_ctrl'
,
'./query_ctrl'
,
],
function
(
angular
,
CloudWatchDatasource
)
{
function
(
CloudWatchDatasource
)
{
'use strict'
;
var
module
=
angular
.
module
(
'grafana.directives'
);
module
.
directive
(
'metricQueryEditorCloudwatch'
,
function
()
{
function
metricsQueryEditor
()
{
return
{
controller
:
'CloudWatchQueryCtrl'
,
templateUrl
:
'app/plugins/datasource/cloudwatch/partials/query.editor.html'
};
}
);
}
module
.
directive
(
'annotationsQueryEditorCloudwatch'
,
function
()
{
function
annotationsQueryEditor
()
{
return
{
templateUrl
:
'app/plugins/datasource/cloudwatch/partials/annotations.editor.html'
};
});
module
.
directive
(
'cloudwatchQueryParameter'
,
function
()
{
return
{
templateUrl
:
'app/plugins/datasource/cloudwatch/partials/query.parameter.html'
,
controller
:
'CloudWatchQueryParameterCtrl'
,
restrict
:
'E'
,
scope
:
{
target
:
"="
,
datasourceName
:
"@"
,
onChange
:
"&"
,
}
};
});
function
configView
()
{
return
{
templateUrl
:
'app/plugins/datasource/cloudwatch/partials/edit_view.html'
};
...
...
@@ -36,5 +21,7 @@ function (angular, CloudWatchDatasource) {
return
{
Datasource
:
CloudWatchDatasource
,
configView
:
configView
,
annotationsQueryEditor
:
annotationsQueryEditor
,
metricsQueryEditor
:
metricsQueryEditor
,
};
});
public/app/plugins/datasource/cloudwatch/partials/annotations.editor.html
View file @
8699d49f
<cloudwatch-query-parameter
target=
"
currentAnnotation"
datasource-name=
"{{currentAnnotation.datasource}}
"
></cloudwatch-query-parameter>
<cloudwatch-query-parameter
target=
"
annotation"
datasource=
"datasource
"
></cloudwatch-query-parameter>
public/app/plugins/datasource/cloudwatch/partials/query.editor.html
View file @
8699d49f
...
...
@@ -35,4 +35,4 @@
<div
class=
"clearfix"
></div>
</div>
<cloudwatch-query-parameter
target=
"target"
datasource
-name=
"{{datasource.name}}
"
on-change=
"refreshMetricData()"
></cloudwatch-query-parameter>
<cloudwatch-query-parameter
target=
"target"
datasource
=
"datasource
"
on-change=
"refreshMetricData()"
></cloudwatch-query-parameter>
public/app/plugins/datasource/cloudwatch/query_parameter_ctrl.js
View file @
8699d49f
...
...
@@ -7,6 +7,19 @@ function (angular, _) {
var
module
=
angular
.
module
(
'grafana.controllers'
);
module
.
directive
(
'cloudwatchQueryParameter'
,
function
()
{
return
{
templateUrl
:
'app/plugins/datasource/cloudwatch/partials/query.parameter.html'
,
controller
:
'CloudWatchQueryParameterCtrl'
,
restrict
:
'E'
,
scope
:
{
target
:
"="
,
datasource
:
"="
,
onChange
:
"&"
,
}
};
});
module
.
controller
(
'CloudWatchQueryParameterCtrl'
,
function
(
$scope
,
templateSrv
,
uiSegmentSrv
,
datasourceSrv
,
$q
)
{
$scope
.
init
=
function
()
{
...
...
@@ -38,12 +51,9 @@ function (angular, _) {
$scope
.
removeDimSegment
=
uiSegmentSrv
.
newSegment
({
fake
:
true
,
value
:
'-- remove dimension --'
});
$scope
.
removeStatSegment
=
uiSegmentSrv
.
newSegment
({
fake
:
true
,
value
:
'-- remove stat --'
});
datasourceSrv
.
get
(
$scope
.
datasourceName
).
then
(
function
(
datasource
)
{
$scope
.
datasource
=
datasource
;
if
(
_
.
isEmpty
(
$scope
.
target
.
region
))
{
$scope
.
target
.
region
=
$scope
.
datasource
.
getDefaultRegion
();
}
});
if
(
!
$scope
.
onChange
)
{
$scope
.
onChange
=
function
()
{};
...
...
public/app/plugins/datasource/elasticsearch/partials/annotations.editor.html
View file @
8699d49f
<div
class=
"editor-row"
>
<div
class=
"section"
ng-if=
"
currentA
nnotation.index"
>
<div
class=
"section"
ng-if=
"
a
nnotation.index"
>
<h5>
Index name
</h5>
<div
class=
"editor-option"
>
<input
type=
"text"
class=
"span4"
ng-model=
'
currentA
nnotation.index'
placeholder=
"events-*"
></input>
<input
type=
"text"
class=
"span4"
ng-model=
'
a
nnotation.index'
placeholder=
"events-*"
></input>
</div>
</div>
<div
class=
"section"
>
<h5>
Search query (lucene)
<tip>
Use [[filterName]] in query to replace part of the query with a filter value
</tip></h5>
<div
class=
"editor-option"
>
<input
type=
"text"
class=
"span6"
ng-model=
'
currentA
nnotation.query'
placeholder=
"tags:deploy"
></input>
<input
type=
"text"
class=
"span6"
ng-model=
'
a
nnotation.query'
placeholder=
"tags:deploy"
></input>
</div>
</div>
</div>
...
...
@@ -18,22 +18,22 @@
<h5>
Field mappings
</h5>
<div
class=
"editor-option"
>
<label
class=
"small"
>
Time
</label>
<input
type=
"text"
class=
"input-small"
ng-model=
'
currentA
nnotation.timeField'
placeholder=
"@timestamp"
></input>
<input
type=
"text"
class=
"input-small"
ng-model=
'
a
nnotation.timeField'
placeholder=
"@timestamp"
></input>
</div>
<div
class=
"editor-option"
>
<label
class=
"small"
>
Title
</label>
<input
type=
"text"
class=
"input-small"
ng-model=
'
currentA
nnotation.titleField'
placeholder=
"desc"
></input>
<input
type=
"text"
class=
"input-small"
ng-model=
'
a
nnotation.titleField'
placeholder=
"desc"
></input>
</div>
<div
class=
"editor-option"
>
<label
class=
"small"
>
Tags
</label>
<input
type=
"text"
class=
"input-small"
ng-model=
'
currentA
nnotation.tagsField'
placeholder=
"tags"
></input>
<input
type=
"text"
class=
"input-small"
ng-model=
'
a
nnotation.tagsField'
placeholder=
"tags"
></input>
</div>
<div
class=
"editor-option"
>
<label
class=
"small"
>
Text
</label>
<input
type=
"text"
class=
"input-small"
ng-model=
'
currentA
nnotation.textField'
placeholder=
""
></input>
<input
type=
"text"
class=
"input-small"
ng-model=
'
a
nnotation.textField'
placeholder=
""
></input>
</div>
</div>
</div>
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